From: Philip Chimento Date: Sun, 13 Mar 2011 00:02:22 +0000 (+0100) Subject: Move construction to glade file X-Git-Tag: v0.9~117 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=7543c5f20317092baacaa868c6fcff273f05e715;p=projects%2Fchimara%2Fchimara.git Move construction to glade file Do as much construction as possible in the glade file, instead of in hand-written code. Removed use of GtkFixed widget. --- diff --git a/player/chimara.ui b/player/chimara.ui index 6ef2c9a..1e0b9a4 100644 --- a/player/chimara.ui +++ b/player/chimara.ui @@ -225,6 +225,12 @@ Philip Chimento + + + + + + False Chimara @@ -249,12 +255,6 @@ Philip Chimento - - - - - - False 5 @@ -441,6 +441,7 @@ Philip Chimento True False + 12 163 @@ -452,8 +453,21 @@ Philip Chimento True True + style-list False False + + + Style Name + True + + + + 0 + + + + @@ -467,21 +481,24 @@ Philip Chimento True False + 6 - + True False + 3 + 2 + 6 + 6 True False + 0 Font: - False - True - 5 - 0 + GTK_FILL @@ -493,23 +510,24 @@ Philip Chimento - True - True - 1 + 1 + 2 + GTK_FILL + + + + + True + False + 0 + Foreground color: + + + 1 + 2 + GTK_FILL - - - False - True - 0 - - - - - 130 - True - False 40 @@ -522,31 +540,24 @@ Philip Chimento - 125 - 10 - - - - - True - False - 5 - Foreground color: - - - 4 - 17 + 1 + 2 + 1 + 2 + GTK_FILL True False + 0 Background color: - 6 - 52 + 2 + 3 + GTK_FILL @@ -561,135 +572,100 @@ Philip Chimento - 125 - 45 + 1 + 2 + 2 + 3 + GTK_FILL + + + True + True + 0 + + + + + True + False + 6 + start - - 283 - 50 + + gtk-justify-left True - False - icons - - - True - False - False - Align _left - True - gtk-justify-left - - - - False - True - - - - - True - False - False - Align _center - True - gtk-justify-center - - - - False - True - - - - - True - False - False - Align _right - True - gtk-justify-right - - - - False - True - - - - - True - False - False - Align _justify - True - gtk-justify-fill - - - - False - True - - - - - True - False - - - False - True - - - - - True - False - False - _Bold - True - gtk-bold - - - - False - True - - - - - True - False - False - _Italic - True - gtk-italic - - - - False - True - - - - - True - False - False - _Underline - True - gtk-underline - - - - False - True - - + True + False + False + True + top + True + False + + + + False + False + 0 + + + + + gtk-justify-center + True + True + False + False + True + top + False + left + + + + False + False + 1 + + + + + gtk-justify-right + True + True + False + False + True + top + False + left + - 86 + False + False + 2 + + + + + gtk-justify-fill + True + True + False + False + True + top + False + left + + + + False + True + 3 @@ -699,6 +675,73 @@ Philip Chimento 1 + + + True + False + 6 + start + + + gtk-bold + True + True + False + False + True + top + False + + + + False + False + 0 + + + + + gtk-italic + True + True + False + False + True + top + False + + + + False + False + 1 + + + + + gtk-underline + True + True + False + False + True + top + False + + + + False + False + 2 + + + + + True + True + 2 + + True @@ -799,7 +842,6 @@ Philip Chimento True Which interpreter to use by default for each story format interpreters - True False True @@ -818,10 +860,10 @@ Philip Chimento Interpreter - available_interpreters + True False + available_interpreters 0 - True @@ -920,4 +962,10 @@ Philip Chimento button-close + + + + + + diff --git a/player/preferences.c b/player/preferences.c index 9626516..ad77ee6 100644 --- a/player/preferences.c +++ b/player/preferences.c @@ -139,7 +139,7 @@ void preferences_create(ChimaraGlk *glk) { /* Initialize the tree of style names */ - GtkTreeStore *style_list = gtk_tree_store_new(1, G_TYPE_STRING); + GtkTreeStore *style_list = GTK_TREE_STORE( load_object("style-list") ); GtkTreeIter buffer, grid, buffer_child, grid_child; gtk_tree_store_append(style_list, &buffer, NULL); @@ -157,25 +157,10 @@ preferences_create(ChimaraGlk *glk) gtk_tree_store_set(style_list, &grid_child, 0, tag_names[i], -1); } - /* Attach the model to the treeview */ - GtkTreeView *view = GTK_TREE_VIEW( load_object("style-treeview") ); - gtk_tree_view_set_model(view, GTK_TREE_MODEL(style_list)); - g_object_unref(style_list); - - /* Set the columns */ - GtkTreeViewColumn *column = gtk_tree_view_column_new(); - gtk_tree_view_column_set_title(column, "Style Name"); - gtk_tree_view_append_column(view, column); - - /* Set the renderers */ - GtkCellRenderer *renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_column_pack_start(column, renderer, TRUE); - gtk_tree_view_column_add_attribute(column, renderer, "text", 0); - /* Set selection mode to single select */ + GtkTreeView *view = GTK_TREE_VIEW( load_object("style-treeview") ); GtkTreeSelection *selection = gtk_tree_view_get_selection(view); gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - g_signal_connect(selection, "changed", G_CALLBACK(style_tree_select_callback), glk); /* Bind the preferences to the entries in the preferences file */ @@ -250,77 +235,41 @@ style_tree_select_callback(GtkTreeSelection *selection, ChimaraGlk *glk) } void -on_toggle_left(GtkToggleToolButton *button, ChimaraGlk *glk) { +on_toggle_left(GtkToggleButton *button, ChimaraGlk *glk) { /* No nothing if the button is deactivated */ - if( !gtk_toggle_tool_button_get_active(button) ) + if( !gtk_toggle_button_get_active(button) ) return; - - /* Untoggle other alignment options */ - GtkToggleToolButton *center = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-center")); - GtkToggleToolButton *right = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-right")); - GtkToggleToolButton *justify = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-justify")); - gtk_toggle_tool_button_set_active(center, FALSE); - gtk_toggle_tool_button_set_active(right, FALSE); - gtk_toggle_tool_button_set_active(justify, FALSE); - g_object_set(current_tag, "justification", GTK_JUSTIFY_LEFT, "justification-set", TRUE, NULL); chimara_glk_update_style(glk); } void -on_toggle_center(GtkToggleToolButton *button, ChimaraGlk *glk) { - if( !gtk_toggle_tool_button_get_active(button) ) +on_toggle_center(GtkToggleButton *button, ChimaraGlk *glk) { + if( !gtk_toggle_button_get_active(button) ) return; - - /* Untoggle other alignment options */ - GtkToggleToolButton *left = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-left")); - GtkToggleToolButton *right = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-right")); - GtkToggleToolButton *justify = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-justify")); - gtk_toggle_tool_button_set_active(left, FALSE); - gtk_toggle_tool_button_set_active(right, FALSE); - gtk_toggle_tool_button_set_active(justify, FALSE); - g_object_set(current_tag, "justification", GTK_JUSTIFY_CENTER, "justification-set", TRUE, NULL); chimara_glk_update_style(glk); } void -on_toggle_right(GtkToggleToolButton *button, ChimaraGlk *glk) { - if( !gtk_toggle_tool_button_get_active(button) ) +on_toggle_right(GtkToggleButton *button, ChimaraGlk *glk) { + if( !gtk_toggle_button_get_active(button) ) return; - - /* Untoggle other alignment options */ - GtkToggleToolButton *left = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-left")); - GtkToggleToolButton *center = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-center")); - GtkToggleToolButton *justify = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-justify")); - gtk_toggle_tool_button_set_active(left, FALSE); - gtk_toggle_tool_button_set_active(center, FALSE); - gtk_toggle_tool_button_set_active(justify, FALSE); - g_object_set(current_tag, "justification", GTK_JUSTIFY_RIGHT, "justification-set", TRUE, NULL); chimara_glk_update_style(glk); } void -on_toggle_justify(GtkToggleToolButton *button, ChimaraGlk *glk) { - if( !gtk_toggle_tool_button_get_active(button) ) +on_toggle_justify(GtkToggleButton *button, ChimaraGlk *glk) { + if( !gtk_toggle_button_get_active(button) ) return; - - /* Untoggle other alignment options */ - GtkToggleToolButton *left = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-left")); - GtkToggleToolButton *center = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-center")); - GtkToggleToolButton *right = GTK_TOGGLE_TOOL_BUTTON(load_object("toolbutton-right")); - gtk_toggle_tool_button_set_active(left, FALSE); - gtk_toggle_tool_button_set_active(center, FALSE); - gtk_toggle_tool_button_set_active(right, FALSE); - g_object_set(current_tag, "justification", GTK_JUSTIFY_FILL, "justification-set", TRUE, NULL); chimara_glk_update_style(glk); } void -on_toggle_bold(GtkToggleToolButton *button, ChimaraGlk *glk) { - if( gtk_toggle_tool_button_get_active(button) ) +on_toggle_bold(GtkToggleButton *button, ChimaraGlk *glk) { + if( gtk_toggle_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); @@ -329,8 +278,8 @@ on_toggle_bold(GtkToggleToolButton *button, ChimaraGlk *glk) { } void -on_toggle_italic(GtkToggleToolButton *button, ChimaraGlk *glk) { - if( gtk_toggle_tool_button_get_active(button) ) +on_toggle_italic(GtkToggleButton *button, ChimaraGlk *glk) { + if( gtk_toggle_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); @@ -339,8 +288,8 @@ on_toggle_italic(GtkToggleToolButton *button, ChimaraGlk *glk) { } void -on_toggle_underline(GtkToggleToolButton *button, ChimaraGlk *glk) { - if( gtk_toggle_tool_button_get_active(button) ) +on_toggle_underline(GtkToggleButton *button, ChimaraGlk *glk) { + if( gtk_toggle_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);