[gnumeric] ui: introduce gnm_gtk_builder_new.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ui: introduce gnm_gtk_builder_new.
- Date: Fri, 15 Oct 2010 17:27:15 +0000 (UTC)
commit cd0a6185eaa227203d2a95374facc75ae80871d0
Author: Morten Welinder <terra gnome org>
Date: Fri Oct 15 13:26:56 2010 -0400
ui: introduce gnm_gtk_builder_new.
ChangeLog | 38 ++++++++++++++++++++++--------------
src/dialogs/dialog-search.c | 5 +---
src/dialogs/dialog-sheet-resize.c | 5 +---
src/dialogs/dialog-so-list.c | 5 +---
src/gui-util.c | 16 +++++++++++++++
src/gui-util.h | 2 +
src/sheet-object-widget.c | 35 ++++++++++++++-------------------
7 files changed, 59 insertions(+), 47 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4c6a2c7..07a1d05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,15 @@
+2010-10-15 Morten Welinder <terra gnome org>
+
+ * src/sheet-object-widget.c (sheet_widget_frame_user_config): Use
+ gnm_gtk_builder_new and handle failures.
+
+ * src/gui-util.c (gnm_gtk_builder_new): New function that knows
+ about Gnumeric's directory structure.
+
2010-10-11 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/undo.c (gnm_undo_colrow_set_sizes_undo): plug leak
-
+
2010-10-11 Jean Brefort <jean brefort normalesup org>
* src/sheet-object-widget.c (cb_frame_config_destroy),
@@ -32,7 +40,7 @@
(actions): connect the above
* src/wbc-gtk.c (wbcg_menu_state_update): handle MS_PAGE_BREAKS
* src/workbook-control.h (MS_PAGE_BREAKS): new
-
+
2010-10-07 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/print-info.c (print_info_set_paper_orientation): correct
@@ -46,7 +54,7 @@
* src/commands.h (cmd_so_set_links): add argument
* src/commands.c (cmd_so_set_links): add argument
(cmd_so_set_links_redo): handle output ttpe
- * src/sheet-object-widget.h
+ * src/sheet-object-widget.h
(sheet_widget_list_base_set_result_type): new
(sheet_widget_list_base_result_type_is_index): new
* src/sheet-object-widget.c
@@ -58,12 +66,12 @@
2010-10-04 Andreas J. Guelzow <aguelzow pyrshep ca>
- * src/sheet-object-widget.c (cb_list_model_changed): save current
+ * src/sheet-object-widget.c (cb_list_model_changed): save current
selection and flag selection as saved.
(cb_selection_changed): don't bother if the selection was saved
- (sheet_widget_list_create_widget): try to set the selection only if
+ (sheet_widget_list_create_widget): try to set the selection only if
we have one.
-
+
2010-10-04 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-object-widget.c (sheet_widget_list_create_widget): set the
@@ -80,7 +88,7 @@
2010-10-01 Andreas J. Guelzow <aguelzow pyrshep ca>
- * sheet-object-widget.c (sheet_widget_button_init_full: disable
+ * sheet-object-widget.c (sheet_widget_button_init_full: disable
printing by default
(sheet_widget_adjustment_init_full): ditto
(sheet_widget_list_base_init): ditto
@@ -116,24 +124,24 @@
all callers
(sheet_widget_frame_draw_cairo): new
(sheet_widget_scrollbar_horizontal_draw_cairo): fix alignment
-
+
2010-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
- * src/sheet-object-widget.c
+ * src/sheet-object-widget.c
(sheet_widget_scrollbar_*_draw_cairo): new
(sheet_widget_scrollbar_draw_cairo): new
- (sheet_widget_scrollbar_class_init): connect
+ (sheet_widget_scrollbar_class_init): connect
sheet_widget_slider_draw_cairo
- (sheet_widget_slider_vertical_draw_cairo): use
+ (sheet_widget_slider_vertical_draw_cairo): use
sheet_widget_slider_horizontal_draw_cairo
-
+
2010-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
- * schemas/gnumeric-general.schemas.in: fix tooltip for column
+ * schemas/gnumeric-general.schemas.in: fix tooltip for column
and row numbers
- * src/sheet-object-widget.c (sheet_widget_slider_*_draw_cairo):
+ * src/sheet-object-widget.c (sheet_widget_slider_*_draw_cairo):
new
(sheet_widget_slider_draw_cairo): new
- (sheet_widget_slider_class_init): connect
+ (sheet_widget_slider_class_init): connect
sheet_widget_slider_draw_cairo
2010-09-28 Morten Welinder <terra gnome org>
diff --git a/src/dialogs/dialog-search.c b/src/dialogs/dialog-search.c
index fca3430..7633001 100644
--- a/src/dialogs/dialog-search.c
+++ b/src/dialogs/dialog-search.c
@@ -479,7 +479,6 @@ dialog_search (WBCGtk *wbcg)
GtkDialog *dialog;
DialogState *dd;
GtkTable *table;
- char *f;
g_return_if_fail (wbcg != NULL);
@@ -489,9 +488,7 @@ dialog_search (WBCGtk *wbcg)
return;
#endif
- f = g_build_filename (gnm_sys_data_dir (), "ui", "search.ui", NULL);
- gui = go_gtk_builder_new (f, NULL, GO_CMD_CONTEXT (wbcg));
- g_free (f);
+ gui = gnm_gtk_builder_new ("search.ui", NULL, GO_CMD_CONTEXT (wbcg));
if (gui == NULL)
return;
diff --git a/src/dialogs/dialog-sheet-resize.c b/src/dialogs/dialog-sheet-resize.c
index 1f811fb..f5480b7 100644
--- a/src/dialogs/dialog-sheet-resize.c
+++ b/src/dialogs/dialog-sheet-resize.c
@@ -146,13 +146,10 @@ dialog_sheet_resize (WBCGtk *wbcg)
GtkBuilder *gui;
ResizeState *state;
int slider_width;
- char *f;
if (gnumeric_dialog_raise_if_exists (wbcg, RESIZE_DIALOG_KEY))
return;
- f = g_build_filename (gnm_sys_data_dir (), "ui", "sheet-resize.ui", NULL);
- gui = go_gtk_builder_new (f, NULL, GO_CMD_CONTEXT (wbcg));
- g_free (f);
+ gui = gnm_gtk_builder_new ("sheet-resize.ui", NULL, GO_CMD_CONTEXT (wbcg));
if (gui == NULL)
return;
diff --git a/src/dialogs/dialog-so-list.c b/src/dialogs/dialog-so-list.c
index dda8703..f9a1149 100644
--- a/src/dialogs/dialog-so-list.c
+++ b/src/dialogs/dialog-so-list.c
@@ -102,11 +102,8 @@ so_list_init (GnmDialogSOList *state, WBCGtk *wbcg, SheetObject *so)
GtkTable *table;
GnmExprTop const *texpr;
GtkBuilder *gui;
- char *f;
- f = g_build_filename (gnm_sys_data_dir (), "ui", "so-list.ui", NULL);
- gui = go_gtk_builder_new (f, NULL, GO_CMD_CONTEXT (wbcg));
- g_free (f);
+ gui = gnm_gtk_builder_new ("so-list.ui", NULL, GO_CMD_CONTEXT (wbcg));
if (gui == NULL)
return TRUE;
diff --git a/src/gui-util.c b/src/gui-util.c
index 3292515..4580a65 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -571,6 +571,22 @@ gnm_glade_xml_new (GOCmdContext *cc, char const *gladefile,
return gui;
}
+GtkBuilder *
+gnm_gtk_builder_new (char const *uifile, char const *domain, GOCmdContext *cc)
+{
+ GtkBuilder *gui;
+
+ char *f = g_path_is_absolute (uifile)
+ ? g_strdup (uifile)
+ : g_build_filename (gnm_sys_data_dir (), "ui", uifile, NULL);
+
+ gui = go_gtk_builder_new (f, domain, cc);
+ g_free (f);
+
+ return gui;
+}
+
+
static void
popup_item_activate (GtkWidget *item, gpointer *user_data)
{
diff --git a/src/gui-util.h b/src/gui-util.h
index f5af754..cd83e75 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -50,6 +50,8 @@ GtkWidget *gnumeric_create_tooltip (GtkWidget *ref_widget);
GladeXML *gnm_glade_xml_new (GOCmdContext *cc, char const *gladefile,
char const *root, char const *domain);
+GtkBuilder *gnm_gtk_builder_new (char const *uifile, char const *domain,
+ GOCmdContext *cc);
typedef struct {
char const *name;
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 57a7c06..1650f85 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -533,7 +533,6 @@ sheet_widget_frame_user_config (SheetObject *so, SheetControl *sc)
FrameConfigState *state;
GtkWidget *table;
GtkBuilder *gui;
- char *f;
g_return_if_fail (swf != NULL);
@@ -541,9 +540,9 @@ sheet_widget_frame_user_config (SheetObject *so, SheetControl *sc)
if (gnumeric_dialog_raise_if_exists (wbcg, SHEET_OBJECT_CONFIG_KEY))
return;
- f = g_build_filename (gnm_sys_data_dir (), "ui", "so-frame.ui", NULL);
- gui = go_gtk_builder_new (f, NULL, GO_CMD_CONTEXT (wbcg));
- g_free (f);
+ gui = gnm_gtk_builder_new ("so-frame.ui", NULL, GO_CMD_CONTEXT (wbcg));
+ if (!gui)
+ return;
state = g_new (FrameConfigState, 1);
state->swf = swf;
state->wbcg = wbcg;
@@ -923,7 +922,6 @@ sheet_widget_button_user_config (SheetObject *so, SheetControl *sc)
ButtonConfigState *state;
GtkWidget *table;
GtkBuilder *gui;
- char *f;
g_return_if_fail (swb != NULL);
@@ -931,9 +929,9 @@ sheet_widget_button_user_config (SheetObject *so, SheetControl *sc)
if (gnumeric_dialog_raise_if_exists (wbcg, SHEET_OBJECT_CONFIG_KEY))
return;
- f = g_build_filename (gnm_sys_data_dir (), "ui", "so-button.ui", NULL);
- gui = go_gtk_builder_new (f, NULL, GO_CMD_CONTEXT (wbcg));
- g_free (f);
+ gui = gnm_gtk_builder_new ("so-button.ui", NULL, GO_CMD_CONTEXT (wbcg));
+ if (!gui)
+ return;
state = g_new (ButtonConfigState, 1);
state->swb = swb;
state->wbcg = wbcg;
@@ -1524,7 +1522,6 @@ sheet_widget_adjustment_user_config_impl (SheetObject *so, SheetControl *sc, cha
AdjustmentConfigState *state;
GtkWidget *table;
GtkBuilder *gui;
- char *f;
gboolean has_directions = (swa_class->htype != G_TYPE_NONE &&
swa_class->vtype != G_TYPE_NONE);
@@ -1532,9 +1529,9 @@ sheet_widget_adjustment_user_config_impl (SheetObject *so, SheetControl *sc, cha
if (gnumeric_dialog_raise_if_exists (wbcg, SHEET_OBJECT_CONFIG_KEY))
return;
- f = g_build_filename (gnm_sys_data_dir (), "ui", "so-scrollbar.ui", NULL);
- gui = go_gtk_builder_new (f, NULL, GO_CMD_CONTEXT (wbcg));
- g_free (f);
+ gui = gnm_gtk_builder_new ("so-scrollbar.ui", NULL, GO_CMD_CONTEXT (wbcg));
+ if (!gui)
+ return;
state = g_new (AdjustmentConfigState, 1);
state->swa = swa;
state->wbcg = wbcg;
@@ -2360,7 +2357,6 @@ sheet_widget_checkbox_user_config (SheetObject *so, SheetControl *sc)
CheckboxConfigState *state;
GtkWidget *table;
GtkBuilder *gui;
- char *f;
g_return_if_fail (swc != NULL);
@@ -2368,9 +2364,9 @@ sheet_widget_checkbox_user_config (SheetObject *so, SheetControl *sc)
if (gnumeric_dialog_raise_if_exists (wbcg, SHEET_OBJECT_CONFIG_KEY))
return;
- f = g_build_filename (gnm_sys_data_dir (), "ui", "so-checkbox.ui", NULL);
- gui = go_gtk_builder_new (f, NULL, GO_CMD_CONTEXT (wbcg));
- g_free (f);
+ gui = gnm_gtk_builder_new ("so-checkbox.ui", NULL, GO_CMD_CONTEXT (wbcg));
+ if (!gui)
+ return;
state = g_new (CheckboxConfigState, 1);
state->swc = swc;
state->wbcg = wbcg;
@@ -3079,7 +3075,6 @@ sheet_widget_radio_button_user_config (SheetObject *so, SheetControl *sc)
GtkWidget *table;
GString *valstr;
GtkBuilder *gui;
- char *f;
g_return_if_fail (swrb != NULL);
@@ -3087,9 +3082,9 @@ sheet_widget_radio_button_user_config (SheetObject *so, SheetControl *sc)
if (gnumeric_dialog_raise_if_exists (wbcg, SHEET_OBJECT_CONFIG_KEY))
return;
- f = g_build_filename (gnm_sys_data_dir (), "ui", "so-radiobutton.ui", NULL);
- gui = go_gtk_builder_new (f, NULL, GO_CMD_CONTEXT (wbcg));
- g_free (f);
+ gui = gnm_gtk_builder_new ("so-radiobutton.ui", NULL, GO_CMD_CONTEXT (wbcg));
+ if (!gui)
+ return;
state = g_new (RadioButtonConfigState, 1);
state->swrb = swrb;
state->wbcg = wbcg;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]