From 0b4a489488a68d57f4fc9fb785f932df2184d202 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 1 Mar 2011 22:01:54 +0100 Subject: [PATCH] Use callbacks of style editing buttons Instead of using the GtkActions I removed in the last commit --- player/chimara.ui | 191 ++++++++++++++++++++++--------------------- player/preferences.c | 28 +++---- 2 files changed, 113 insertions(+), 106 deletions(-) diff --git a/player/chimara.ui b/player/chimara.ui index 81ca3ae..7a60d05 100644 --- a/player/chimara.ui +++ b/player/chimara.ui @@ -4,77 +4,75 @@ - - _Game - _Game + + _Toolbar + Show a toolbar at the top of the window + - - _Open... - _Open - Quit the current game and load a new one - gtk-media-play - + + _View - - - _Restore... - _Restore - Restore a previously saved game - gtk-open - + + _About... + _About + About this application + gtk-about + - - - _Save - _Save - Save the game - gtk-save - + + _Help + _Help - - _Quit Chimara - _Quit Chimara - Leave the program - gtk-quit - + + P_references + P_references + Configure the application + gtk-preferences + - - _Command - _Command + + _Paste + _Paste + Paste the clipboard + gtk-paste + - - _Edit - _Edit + + _Copy + _Copy + Copy the selection + gtk-copy + - - _Stop Game - _Stop - Immediately stop the running game - gtk-stop - + + _Quit + _Quit + Try to quit the game + gtk-media-stop + - - Open _Recent - Open _Recent - 10 - mru - + + Res_tart + Res_tart + Tell the game to restart + gtk-media-rewind + @@ -88,75 +86,77 @@ - - Res_tart - Res_tart - Tell the game to restart - gtk-media-rewind - + + Open _Recent + Open _Recent + 10 + mru + - - _Quit - _Quit - Try to quit the game - gtk-media-stop - + + _Stop Game + _Stop + Immediately stop the running game + gtk-stop + - - _Copy - _Copy - Copy the selection - gtk-copy - + + _Edit + _Edit - - _Paste - _Paste - Paste the clipboard - gtk-paste - + + _Command + _Command - - P_references - P_references - Configure the application - gtk-preferences - + + _Quit Chimara + _Quit Chimara + Leave the program + gtk-quit + - - _Help - _Help + + _Save + _Save + Save the game + gtk-save + - - _About... - _About - About this application - gtk-about - + + _Restore... + _Restore + Restore a previously saved game + gtk-open + + - - _View + + _Open... + _Open + Quit the current game and load a new one + gtk-media-play + + - - _Toolbar - Show a toolbar at the top of the window - + + _Game + _Game @@ -574,6 +574,7 @@ Philip Chimento Align _left True gtk-justify-left + False @@ -588,6 +589,7 @@ Philip Chimento Align _center True gtk-justify-center + False @@ -602,6 +604,7 @@ Philip Chimento Align _right True gtk-justify-right + False @@ -616,6 +619,7 @@ Philip Chimento Align _justify True gtk-justify-fill + False @@ -640,6 +644,7 @@ Philip Chimento _Bold True gtk-bold + False @@ -654,6 +659,7 @@ Philip Chimento _Italic True gtk-italic + False @@ -668,6 +674,7 @@ Philip Chimento _Underline True gtk-underline + False diff --git a/player/preferences.c b/player/preferences.c index afb34a4..157a784 100644 --- a/player/preferences.c +++ b/player/preferences.c @@ -116,9 +116,9 @@ style_tree_select_callback(GtkTreeSelection *selection, ChimaraGlk *glk) } void -on_toggle_left(GtkToggleAction *action, ChimaraGlk *glk) { +on_toggle_left(GtkToggleToolButton *button, ChimaraGlk *glk) { /* No nothing if the button is deactivated */ - if( !gtk_toggle_action_get_active(action) ) + if( !gtk_toggle_tool_button_get_active(button) ) return; /* Untoggle other alignment options */ @@ -134,8 +134,8 @@ on_toggle_left(GtkToggleAction *action, ChimaraGlk *glk) { } void -on_toggle_center(GtkToggleAction *action, ChimaraGlk *glk) { - if( !gtk_toggle_action_get_active(action) ) +on_toggle_center(GtkToggleToolButton *button, ChimaraGlk *glk) { + if( !gtk_toggle_tool_button_get_active(button) ) return; /* Untoggle other alignment options */ @@ -151,8 +151,8 @@ on_toggle_center(GtkToggleAction *action, ChimaraGlk *glk) { } void -on_toggle_right(GtkToggleAction *action, ChimaraGlk *glk) { - if( !gtk_toggle_action_get_active(action) ) +on_toggle_right(GtkToggleToolButton *button, ChimaraGlk *glk) { + if( !gtk_toggle_tool_button_get_active(button) ) return; /* Untoggle other alignment options */ @@ -168,8 +168,8 @@ on_toggle_right(GtkToggleAction *action, ChimaraGlk *glk) { } void -on_toggle_justify(GtkToggleAction *action, ChimaraGlk *glk) { - if( !gtk_toggle_action_get_active(action) ) +on_toggle_justify(GtkToggleToolButton *button, ChimaraGlk *glk) { + if( !gtk_toggle_tool_button_get_active(button) ) return; /* Untoggle other alignment options */ @@ -185,8 +185,8 @@ on_toggle_justify(GtkToggleAction *action, ChimaraGlk *glk) { } void -on_toggle_bold(GtkToggleAction *action, ChimaraGlk *glk) { - if( gtk_toggle_action_get_active(action) ) +on_toggle_bold(GtkToggleToolButton *button, ChimaraGlk *glk) { + if( gtk_toggle_tool_button_get_active(button) ) g_object_set(current_tag, "weight", PANGO_WEIGHT_BOLD, "weight-set", TRUE, NULL); else g_object_set(current_tag, "weight", PANGO_WEIGHT_NORMAL, "weight-set", TRUE, NULL); @@ -195,8 +195,8 @@ on_toggle_bold(GtkToggleAction *action, ChimaraGlk *glk) { } void -on_toggle_italic(GtkToggleAction *action, ChimaraGlk *glk) { - if( gtk_toggle_action_get_active(action) ) +on_toggle_italic(GtkToggleToolButton *button, ChimaraGlk *glk) { + if( gtk_toggle_tool_button_get_active(button) ) g_object_set(current_tag, "style", PANGO_STYLE_ITALIC, "style-set", TRUE, NULL); else g_object_set(current_tag, "style", PANGO_STYLE_NORMAL, "style-set", TRUE, NULL); @@ -205,8 +205,8 @@ on_toggle_italic(GtkToggleAction *action, ChimaraGlk *glk) { } void -on_toggle_underline(GtkToggleAction *action, ChimaraGlk *glk) { - if( gtk_toggle_action_get_active(action) ) +on_toggle_underline(GtkToggleToolButton *button, ChimaraGlk *glk) { + if( gtk_toggle_tool_button_get_active(button) ) g_object_set(current_tag, "underline", PANGO_UNDERLINE_SINGLE, "underline-set", TRUE, NULL); else g_object_set(current_tag, "underline", PANGO_UNDERLINE_NONE, "underline-set", TRUE, NULL); -- 2.30.2