summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baobab/src/baobab-prefs.c7
-rw-r--r--baobab/src/baobab-treeview.c8
-rw-r--r--baobab/src/baobab-utils.c18
-rw-r--r--baobab/src/baobab-utils.h2
-rw-r--r--baobab/src/baobab.c64
-rw-r--r--logview/src/logview-filter-manager.c55
-rw-r--r--mate-dictionary/src/gdict-pref-dialog.c15
-rw-r--r--mate-dictionary/src/gdict-source-dialog.c49
-rw-r--r--mate-screenshot/src/screenshot-dialog.c24
9 files changed, 103 insertions, 139 deletions
diff --git a/baobab/src/baobab-prefs.c b/baobab/src/baobab-prefs.c
index cdbb92c3..56e37e51 100644
--- a/baobab/src/baobab-prefs.c
+++ b/baobab/src/baobab-prefs.c
@@ -35,6 +35,7 @@
#include "baobab-prefs.h"
#define BAOBAB_PREFERENCES_UI_RESOURCE "/org/mate/disk-usage-analyzer/baobab-dialog-scan-props.ui"
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
enum
{
@@ -162,7 +163,7 @@ create_tree_props (GtkBuilder *builder, GtkTreeModel *model)
GtkTreeViewColumn *col;
GtkWidget *tvw;
- tvw = GTK_WIDGET (gtk_builder_get_object (builder , "tree_view_props"));
+ tvw = GET_WIDGET ("tree_view_props");
/* checkbox column */
cell = gtk_cell_renderer_toggle_new ();
@@ -294,7 +295,7 @@ baobab_prefs_dialog (void)
return;
}
- dlg = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_scan_props"));
+ dlg = GET_WIDGET ("dialog_scan_props");
gtk_window_set_transient_for (GTK_WINDOW (dlg),
GTK_WINDOW (baobab.window));
@@ -312,7 +313,7 @@ baobab_prefs_dialog (void)
create_tree_props (builder, GTK_TREE_MODEL (model));
fill_props_model (model);
- check_enablehome = GTK_WIDGET (gtk_builder_get_object (builder, "check_enable_home"));
+ check_enablehome = GET_WIDGET ("check_enable_home");
g_settings_bind (baobab.prefs_settings,
BAOBAB_SETTINGS_MONITOR_HOME,
check_enablehome, "active",
diff --git a/baobab/src/baobab-treeview.c b/baobab/src/baobab-treeview.c
index eb6beb5e..8e5b7839 100644
--- a/baobab/src/baobab-treeview.c
+++ b/baobab/src/baobab-treeview.c
@@ -34,6 +34,8 @@
#include "baobab-utils.h"
#include "callbacks.h"
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, (x))))
+
static GtkTreeStore *
create_model (void)
{
@@ -199,9 +201,8 @@ create_directory_treeview (void)
{
GtkCellRenderer *cell;
GtkTreeViewColumn *col;
- GtkWidget *scrolled;
- GtkWidget *tvw = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, "treeview1"));
+ GtkWidget *tvw = GET_WIDGET ("treeview1");
g_signal_connect (tvw, "row-expanded",
G_CALLBACK (on_tv_row_expanded), NULL);
@@ -285,8 +286,7 @@ create_directory_treeview (void)
gtk_tree_view_collapse_all (GTK_TREE_VIEW (tvw));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tvw), FALSE);
- scrolled = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, "scrolledwindow1"));
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (GET_WIDGET ("scrolledwindow1")),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
diff --git a/baobab/src/baobab-utils.c b/baobab/src/baobab-utils.c
index 022c3a0d..5aaec321 100644
--- a/baobab/src/baobab-utils.c
+++ b/baobab/src/baobab-utils.c
@@ -145,24 +145,6 @@ on_toggled (GtkToggleButton *togglebutton, gpointer dialog)
(GTK_FILE_CHOOSER (dialog)));
}
-void
-set_ui_action_sens (const gchar *name, gboolean sens)
-{
- GtkAction *a;
-
- a = GTK_ACTION (gtk_builder_get_object (baobab.main_ui, name));
- gtk_action_set_sensitive (a, sens);
-}
-
-void
-set_ui_widget_sens (const gchar *name, gboolean sens)
-{
- GtkWidget *w;
-
- w = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, name));
- gtk_widget_set_sensitive (w, sens);
-}
-
gboolean
show_bars (GtkTreeModel *mdl,
GtkTreePath *path,
diff --git a/baobab/src/baobab-utils.h b/baobab/src/baobab-utils.h
index 7ef23987..d47ba798 100644
--- a/baobab/src/baobab-utils.h
+++ b/baobab/src/baobab-utils.h
@@ -40,8 +40,6 @@ void popupmenu_list (GtkTreePath *path, GdkEventButton *event, gboolean can_tras
void open_file_with_application (GFile *file);
gboolean can_trash_file (GFile *file);
gboolean trash_file (GFile *file);
-void set_ui_action_sens (const gchar *name, gboolean sens);
-void set_ui_widget_sens (const gchar *name, gboolean sens);
gboolean baobab_help_display (GtkWindow *parent, const gchar *file_name, const gchar *link_id);
gboolean is_virtual_filesystem (GFile *file);
diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c
index 84e02182..4ad034ed 100644
--- a/baobab/src/baobab.c
+++ b/baobab/src/baobab.c
@@ -38,6 +38,9 @@
#include "baobab-ringschart.h"
#define BAOBAB_UI_RESOURCE "/org/mate/disk-usage-analyzer/baobab-main-window.ui"
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, (x))))
+#define GET_ACTION(x) (GTK_ACTION (gtk_builder_get_object (baobab.main_ui, (x))))
+#define GET_TOGGLE_ACTION(x) (GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui, (x))))
static void push_iter_in_stack (GtkTreeIter *);
static GtkTreeIter pop_iter_from_stack (void);
@@ -137,27 +140,27 @@ check_menu_sens (gboolean scanning)
gtk_main_iteration ();
baobab_set_statusbar (_("Scanning..."));
- set_ui_action_sens ("expand_all", TRUE);
- set_ui_action_sens ("collapse_all", TRUE);
+ gtk_action_set_sensitive (GET_ACTION ("expand_all"), TRUE);
+ gtk_action_set_sensitive (GET_ACTION ("collapse_all"), TRUE);
}
has_current_location = baobab.current_location != NULL;
- set_ui_action_sens ("menuscanhome", !scanning);
- set_ui_action_sens ("menuallfs", !scanning);
- set_ui_action_sens ("menuscandir", !scanning);
- set_ui_action_sens ("menustop", scanning);
- set_ui_action_sens ("menurescan", !scanning && has_current_location);
- set_ui_action_sens ("preferenze1", !scanning);
- set_ui_action_sens ("menu_scan_rem", !scanning);
- set_ui_action_sens ("ck_allocated", !scanning && baobab.is_local);
-
- set_ui_widget_sens ("tbscanhome", !scanning);
- set_ui_widget_sens ("tbscanall", !scanning);
- set_ui_widget_sens ("tbscandir", !scanning);
- set_ui_widget_sens ("tbstop", scanning);
- set_ui_widget_sens ("tbrescan", !scanning && has_current_location);
- set_ui_widget_sens ("tb_scan_remote", !scanning);
+ gtk_action_set_sensitive (GET_ACTION ("menuscanhome"), !scanning);
+ gtk_action_set_sensitive (GET_ACTION ("menuallfs"), !scanning);
+ gtk_action_set_sensitive (GET_ACTION ("menuscandir"), !scanning);
+ gtk_action_set_sensitive (GET_ACTION ("menustop"), scanning);
+ gtk_action_set_sensitive (GET_ACTION ("menurescan"), !scanning && has_current_location);
+ gtk_action_set_sensitive (GET_ACTION ("preferenze1"), !scanning);
+ gtk_action_set_sensitive (GET_ACTION ("menu_scan_rem"), !scanning);
+ gtk_action_set_sensitive (GET_ACTION ("ck_allocated"), !scanning && baobab.is_local);
+
+ gtk_widget_set_sensitive (GET_WIDGET ("tbscanhome"), !scanning);
+ gtk_widget_set_sensitive (GET_WIDGET ("tbscanall"), !scanning);
+ gtk_widget_set_sensitive (GET_WIDGET ("tbscandir"), !scanning);
+ gtk_widget_set_sensitive (GET_WIDGET ("tbstop"), scanning);
+ gtk_widget_set_sensitive (GET_WIDGET ("tbrescan"), !scanning && has_current_location);
+ gtk_widget_set_sensitive (GET_WIDGET ("tb_scan_remote"), !scanning);
}
static void
@@ -174,7 +177,6 @@ update_scan_label (void)
gchar *total;
gchar *used;
gchar *available;
- GtkWidget *label;
total = g_format_size (baobab.fs.total);
used = g_format_size (baobab.fs.used);
@@ -190,9 +192,7 @@ update_scan_label (void)
g_free (used);
g_free (available);
- label = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, "label1"));
-
- gtk_label_set_markup (GTK_LABEL (label), markup);
+ gtk_label_set_markup (GTK_LABEL (GET_WIDGET ("label1")), markup);
g_free (markup);
}
@@ -228,7 +228,7 @@ baobab_scan_location (GFile *file)
/* check if the file system is local or remote */
baobab.is_local = scan_is_local (file);
- ck_allocated = GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui, "ck_allocated"));
+ ck_allocated = GET_TOGGLE_ACTION ("ck_allocated");
if (!baobab.is_local) {
gtk_toggle_action_set_active (ck_allocated, FALSE);
gtk_action_set_sensitive (GTK_ACTION (ck_allocated), FALSE);
@@ -649,7 +649,7 @@ baobab_create_toolbar (void)
GtkToolItem *item;
GtkToolItem *separator;
- toolbar = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, "toolbar1"));
+ toolbar = GET_WIDGET ("toolbar1");
if (toolbar == NULL) {
g_printerr ("Could not build toolbar\n");
return;
@@ -679,7 +679,7 @@ baobab_create_toolbar (void)
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (baobab.ui_settings,
BAOBAB_SETTINGS_TOOLBAR_VISIBLE,
- GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui, "view_tb")), "active",
+ GET_TOGGLE_ACTION ("view_tb"), "active",
G_SETTINGS_BIND_DEFAULT);
}
@@ -687,8 +687,7 @@ baobab_create_toolbar (void)
static void
baobab_create_statusbar (void)
{
- baobab.statusbar = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui,
- "statusbar1"));
+ baobab.statusbar = GET_WIDGET ("statusbar1");
if (baobab.statusbar == NULL) {
g_printerr ("Could not build statusbar\n");
return;
@@ -700,7 +699,7 @@ baobab_create_statusbar (void)
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (baobab.ui_settings,
BAOBAB_SETTINGS_STATUSBAR_VISIBLE,
- GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui, "view_sb")), "active",
+ GET_TOGGLE_ACTION ("view_sb"), "active",
G_SETTINGS_BIND_DEFAULT);
}
@@ -1103,7 +1102,7 @@ initialize_charts (void)
gtk_frame_set_label_align (GTK_FRAME (baobab.chart_frame), 0.0, 0.0);
gtk_frame_set_shadow_type (GTK_FRAME (baobab.chart_frame), GTK_SHADOW_IN);
- hpaned_main = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, "hpaned_main"));
+ hpaned_main = GET_WIDGET ("hpaned_main");
gtk_paned_pack2 (GTK_PANED (hpaned_main),
baobab.chart_frame, TRUE, TRUE);
gtk_paned_set_position (GTK_PANED (hpaned_main), 480);
@@ -1118,7 +1117,7 @@ initialize_charts (void)
"changed",
G_CALLBACK (on_chart_type_change), NULL);
- hbox1 = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, "hbox1"));
+ hbox1 = GET_WIDGET ("hbox1");
gtk_container_add (GTK_CONTAINER (hbox1), baobab.chart_type_combo);
gtk_box_set_spacing (GTK_BOX (hbox1), 50);
gtk_box_set_child_packing (GTK_BOX (hbox1),
@@ -1282,17 +1281,16 @@ main (int argc, char *argv[])
check_menu_sens (FALSE);
update_scan_label ();
- baobab.window = GTK_WIDGET (gtk_builder_get_object (baobab.main_ui, "baobab_window"));
+ baobab.window = GET_WIDGET ("baobab_window");
gtk_window_set_position (GTK_WINDOW (baobab.window),
GTK_WIN_POS_CENTER);
baobab.tree_view = create_directory_treeview ();
- set_ui_action_sens ("menurescan", FALSE);
+ gtk_action_set_sensitive (GET_ACTION ("menurescan"), FALSE);
/* set allocated space checkbox */
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (gtk_builder_get_object (baobab.main_ui,
- "ck_allocated")),
+ gtk_toggle_action_set_active (GET_TOGGLE_ACTION ("ck_allocated"),
baobab.show_allocated);
gtk_widget_show (baobab.window);
diff --git a/logview/src/logview-filter-manager.c b/logview/src/logview-filter-manager.c
index e086ba76..299a5a53 100644
--- a/logview/src/logview-filter-manager.c
+++ b/logview/src/logview-filter-manager.c
@@ -28,6 +28,7 @@
#include <glib/gi18n.h>
#define UI_RESOURCE "/org/mate/system-log/logview-filter.ui"
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
struct _LogviewFilterManagerPrivate {
GtkWidget *tree;
@@ -180,20 +181,13 @@ on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id,
old_name = g_object_get_data (G_OBJECT (manager), "old_name");
builder = manager->priv->builder;
- entry_name = GTK_WIDGET (gtk_builder_get_object (builder,
- "entry_name"));
- entry_regex = GTK_WIDGET (gtk_builder_get_object (builder,
- "entry_regex"));
- radio_color = GTK_WIDGET (gtk_builder_get_object (builder,
- "radio_color"));
- check_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
- "check_foreground"));
- check_background = GTK_WIDGET (gtk_builder_get_object (builder,
- "check_background"));
- color_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
- "color_foreground"));
- color_background = GTK_WIDGET (gtk_builder_get_object (builder,
- "color_background"));
+ entry_name = GET_WIDGET ("entry_name");
+ entry_regex = GET_WIDGET ("entry_regex");
+ radio_color = GET_WIDGET ("radio_color");
+ check_foreground = GET_WIDGET ("check_foreground");
+ check_background = GET_WIDGET ("check_background");
+ color_foreground = GET_WIDGET ("color_foreground");
+ color_background = GET_WIDGET ("color_background");
if (response_id == GTK_RESPONSE_APPLY) {
name = gtk_entry_get_text (GTK_ENTRY (entry_name));
@@ -286,33 +280,23 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter)
return;
}
- title = (filter != NULL ? _("Edit filter") : _("Add new filter"));
-
- dialog = GTK_WIDGET (gtk_builder_get_object (builder,
- "dialog_filter"));
+ dialog = GET_WIDGET ("dialog_filter");
+ entry_name = GET_WIDGET ("entry_name");
+ entry_regex = GET_WIDGET ("entry_regex");
+ radio_color = GET_WIDGET ("radio_color");
+ radio_visible = GET_WIDGET ("radio_visible");
+ check_foreground = GET_WIDGET ("check_foreground");
+ check_background = GET_WIDGET ("check_background");
+ color_foreground = GET_WIDGET ("color_foreground");
+ color_background = GET_WIDGET ("color_background");
+ vbox_color = GET_WIDGET ("vbox_color");
+ title = (filter != NULL ? _("Edit filter") : _("Add new filter"));
gtk_window_set_title (GTK_WINDOW (dialog), title);
- entry_name = GTK_WIDGET (gtk_builder_get_object (builder,
- "entry_name"));
- entry_regex = GTK_WIDGET (gtk_builder_get_object (builder,
- "entry_regex"));
- radio_color = GTK_WIDGET (gtk_builder_get_object (builder,
- "radio_color"));
- radio_visible = GTK_WIDGET (gtk_builder_get_object (builder,
- "radio_visible"));
-
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_color),
gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_visible)));
- check_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
- "check_foreground"));
- check_background = GTK_WIDGET (gtk_builder_get_object (builder,
- "check_background"));
- color_foreground = GTK_WIDGET (gtk_builder_get_object (builder,
- "color_foreground"));
- color_background = GTK_WIDGET (gtk_builder_get_object (builder,
- "color_background"));
g_signal_connect (check_foreground, "toggled", G_CALLBACK (on_check_toggled),
color_foreground);
g_signal_connect (check_background, "toggled", G_CALLBACK (on_check_toggled),
@@ -323,7 +307,6 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter)
on_check_toggled (GTK_TOGGLE_BUTTON (check_background),
color_background);
- vbox_color = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_color"));
g_signal_connect (radio_color, "toggled", G_CALLBACK (on_check_toggled),
vbox_color);
on_check_toggled (GTK_TOGGLE_BUTTON (radio_color),
diff --git a/mate-dictionary/src/gdict-pref-dialog.c b/mate-dictionary/src/gdict-pref-dialog.c
index 295cce46..4267761d 100644
--- a/mate-dictionary/src/gdict-pref-dialog.c
+++ b/mate-dictionary/src/gdict-pref-dialog.c
@@ -41,6 +41,7 @@
#include "gdict-common.h"
#define GDICT_PREFERENCES_UI PKGDATADIR "/mate-dictionary-preferences.ui"
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (dialog->builder, (x))))
#define DEFAULT_MIN_WIDTH 220
#define DEFAULT_MIN_HEIGHT 330
@@ -690,40 +691,40 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog)
/* the main widget */
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
- GTK_WIDGET (gtk_builder_get_object (dialog->builder, "preferences_root")));
+ GET_WIDGET ("preferences_root"));
/* keep all the interesting widgets around */
- dialog->notebook = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "preferences_notebook"));
+ dialog->notebook = GET_WIDGET ("preferences_notebook");
gtk_widget_add_events (dialog->notebook, GDK_SCROLL_MASK);
g_signal_connect (dialog->notebook, "scroll-event",
G_CALLBACK (gdict_dialog_page_scroll_event_cb), GTK_WINDOW (dialog));
- dialog->sources_view = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "sources_treeview"));
+ dialog->sources_view = GET_WIDGET ("sources_treeview");
build_sources_view (dialog);
dialog->active_source = g_settings_get_string (dialog->settings, GDICT_SETTINGS_SOURCE_KEY);
- dialog->sources_add = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "add_button"));
+ dialog->sources_add = GET_WIDGET ("add_button");
gtk_widget_set_tooltip_text (dialog->sources_add,
_("Add a new dictionary source"));
g_signal_connect (dialog->sources_add, "clicked",
G_CALLBACK (source_add_clicked_cb), dialog);
- dialog->sources_remove = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "remove_button"));
+ dialog->sources_remove = GET_WIDGET ("remove_button");
gtk_widget_set_tooltip_text (dialog->sources_remove,
_("Remove the currently selected dictionary source"));
g_signal_connect (dialog->sources_remove, "clicked",
G_CALLBACK (source_remove_clicked_cb), dialog);
- dialog->sources_edit = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "edit_button"));
+ dialog->sources_edit = GET_WIDGET ("edit_button");
gtk_widget_set_tooltip_text (dialog->sources_edit,
_("Edit the currently selected dictionary source"));
g_signal_connect (dialog->sources_edit, "clicked",
G_CALLBACK (source_edit_clicked_cb), dialog);
font = g_settings_get_string (dialog->settings, GDICT_SETTINGS_PRINT_FONT_KEY);
- dialog->font_button = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "print_font_button"));
+ dialog->font_button = GET_WIDGET ("print_font_button");
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (dialog->font_button), font);
gtk_widget_set_tooltip_text (dialog->font_button,
_("Set the font used for printing the definitions"));
diff --git a/mate-dictionary/src/gdict-source-dialog.c b/mate-dictionary/src/gdict-source-dialog.c
index d5dd54d3..444febdd 100644
--- a/mate-dictionary/src/gdict-source-dialog.c
+++ b/mate-dictionary/src/gdict-source-dialog.c
@@ -40,6 +40,8 @@
#include "gdict-common.h"
#define GDICT_SOURCE_UI PKGDATADIR "/mate-dictionary-source.ui"
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (dialog->builder, (x))))
+#define GET_EDITABLE(x) (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, (x))))
/*********************
* GdictSourceDialog *
@@ -112,10 +114,10 @@ transport_combo_changed_cb (GtkWidget *widget,
if (transport == GDICT_SOURCE_TRANSPORT_DICTD)
{
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "hostname_label")));
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "hostname_entry")));
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_label")));
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_entry")));
+ gtk_widget_show (GET_WIDGET ("hostname_label"));
+ gtk_widget_show (GET_WIDGET ("hostname_entry"));
+ gtk_widget_show (GET_WIDGET ("port_label"));
+ gtk_widget_show (GET_WIDGET ("port_entry"));
if (dialog->action == GDICT_SOURCE_DIALOG_CREATE)
{
@@ -126,10 +128,10 @@ transport_combo_changed_cb (GtkWidget *widget,
}
else
{
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "hostname_label")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "hostname_entry")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_label")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_entry")));
+ gtk_widget_hide (GET_WIDGET ("hostname_label"));
+ gtk_widget_hide (GET_WIDGET ("hostname_entry"));
+ gtk_widget_hide (GET_WIDGET ("port_label"));
+ gtk_widget_hide (GET_WIDGET ("port_entry"));
if (dialog->action == GDICT_SOURCE_DIALOG_CREATE)
{
@@ -147,7 +149,7 @@ get_text_from_entry (GdictSourceDialog *dialog,
GtkWidget *entry;
gchar *retval;
- entry = GTK_WIDGET (gtk_builder_get_object (dialog->builder, entry_name));
+ entry = GET_WIDGET (entry_name);
if (!entry)
return NULL;
@@ -163,7 +165,7 @@ set_text_to_entry (GdictSourceDialog *dialog,
{
GtkWidget *entry;
- entry = GTK_WIDGET (gtk_builder_get_object (dialog->builder, entry_name));
+ entry = GET_WIDGET (entry_name);
if (!entry)
return;
@@ -190,10 +192,10 @@ set_transport_settings (GdictSourceDialog *dialog)
set_text_to_entry (dialog, "hostname_entry", hostname);
set_text_to_entry (dialog, "port_entry", port_str);
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "hostname_label")));
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "hostname_entry")));
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_label")));
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (dialog->builder, "port_entry")));
+ gtk_widget_show (GET_WIDGET ("hostname_label"));
+ gtk_widget_show (GET_WIDGET ("hostname_entry"));
+ gtk_widget_show (GET_WIDGET ("port_label"));
+ gtk_widget_show (GET_WIDGET ("port_entry"));
g_free (port_str);
}
@@ -571,7 +573,6 @@ gdict_source_dialog_constructor (GType type,
{
GObject *object;
GdictSourceDialog *dialog;
- GtkWidget *vbox;
GError *error = NULL;
object = G_OBJECT_CLASS (gdict_source_dialog_parent_class)->constructor (type,
@@ -595,12 +596,12 @@ gdict_source_dialog_constructor (GType type,
/* the main widget */
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
- GTK_WIDGET (gtk_builder_get_object (dialog->builder, "source_root")));
+ GET_WIDGET ("source_root"));
/* the transport combo changes the UI by changing the visible widgets
* bound to the transport's own options.
*/
- dialog->transport_combo = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "transport_combo"));
+ dialog->transport_combo = GET_WIDGET ("transport_combo");
g_signal_connect (dialog->transport_combo, "changed",
G_CALLBACK (transport_combo_changed_cb),
dialog);
@@ -610,14 +611,12 @@ gdict_source_dialog_constructor (GType type,
"gtk-help",
GTK_RESPONSE_HELP);
- vbox = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "db-vbox"));
dialog->db_chooser = gdict_database_chooser_new ();
- gtk_box_pack_start (GTK_BOX (vbox), dialog->db_chooser, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("db-vbox")), dialog->db_chooser, TRUE, TRUE, 0);
gtk_widget_show (dialog->db_chooser);
- vbox = GTK_WIDGET (gtk_builder_get_object (dialog->builder, "strat-vbox"));
dialog->strat_chooser = gdict_strategy_chooser_new ();
- gtk_box_pack_start (GTK_BOX (vbox), dialog->strat_chooser, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("strat-vbox")), dialog->strat_chooser, TRUE, TRUE, 0);
gtk_widget_show (dialog->strat_chooser);
/* the UI changes depending on the action that the source dialog
@@ -627,10 +626,10 @@ gdict_source_dialog_constructor (GType type,
{
case GDICT_SOURCE_DIALOG_VIEW:
/* disable every editable widget */
- gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "name_entry")), FALSE);
- gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "description_entry")), FALSE);
- gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "hostname_entry")), FALSE);
- gtk_editable_set_editable (GTK_EDITABLE (gtk_builder_get_object (dialog->builder, "port_entry")), FALSE);
+ gtk_editable_set_editable (GET_EDITABLE ("name_entry"), FALSE);
+ gtk_editable_set_editable (GET_EDITABLE ("description_entry"), FALSE);
+ gtk_editable_set_editable (GET_EDITABLE ("hostname_entry"), FALSE);
+ gtk_editable_set_editable (GET_EDITABLE ("port_entry"), FALSE);
gtk_widget_set_sensitive (dialog->transport_combo, FALSE);
diff --git a/mate-screenshot/src/screenshot-dialog.c b/mate-screenshot/src/screenshot-dialog.c
index 854ae3e4..66c9cd26 100644
--- a/mate-screenshot/src/screenshot-dialog.c
+++ b/mate-screenshot/src/screenshot-dialog.c
@@ -27,6 +27,8 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (dialog->builder, (x))))
+
enum {
TYPE_IMAGE_PNG,
TYPE_TEXT_URI_LIST,
@@ -42,7 +44,7 @@ static GtkTargetEntry drag_types[] =
struct ScreenshotDialog
{
- GtkBuilder *ui;
+ GtkBuilder *builder;
GdkPixbuf *screenshot;
GdkPixbuf *preview_image;
GtkWidget *save_widget;
@@ -192,11 +194,11 @@ screenshot_dialog_new (GdkPixbuf *screenshot,
dialog = g_new0 (ScreenshotDialog, 1);
- dialog->ui = gtk_builder_new ();
+ dialog->builder = gtk_builder_new ();
dialog->screenshot = screenshot;
- if (gtk_builder_add_from_resource (dialog->ui, "/org/mate/screenshot/mate-screenshot.ui", &error) == 0)
+ if (gtk_builder_add_from_resource (dialog->builder, "/org/mate/screenshot/mate-screenshot.ui", &error) == 0)
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL, 0,
@@ -211,7 +213,7 @@ screenshot_dialog_new (GdkPixbuf *screenshot,
exit (1);
}
- gtk_builder_set_translation_domain (dialog->ui, GETTEXT_PACKAGE);
+ gtk_builder_set_translation_domain (dialog->builder, GETTEXT_PACKAGE);
width = gdk_pixbuf_get_width (screenshot);
height = gdk_pixbuf_get_height (screenshot);
@@ -219,11 +221,11 @@ screenshot_dialog_new (GdkPixbuf *screenshot,
width /= 5;
height /= 5;
- toplevel = GTK_WIDGET (gtk_builder_get_object (dialog->ui, "toplevel"));
- aspect_frame = GTK_WIDGET (gtk_builder_get_object (dialog->ui, "aspect_frame"));
- preview_darea = GTK_WIDGET (gtk_builder_get_object (dialog->ui, "preview_darea"));
- dialog->filename_entry = GTK_WIDGET (gtk_builder_get_object (dialog->ui, "filename_entry"));
- file_chooser_box = GTK_WIDGET (gtk_builder_get_object (dialog->ui, "file_chooser_box"));
+ toplevel = GET_WIDGET ("toplevel");
+ aspect_frame = GET_WIDGET ("aspect_frame");
+ preview_darea = GET_WIDGET ("preview_darea");
+ dialog->filename_entry = GET_WIDGET ("filename_entry");
+ file_chooser_box = GET_WIDGET ("file_chooser_box");
dialog->save_widget = gtk_file_chooser_button_new (_("Select a folder"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog->save_widget), FALSE);
@@ -287,7 +289,7 @@ screenshot_dialog_enable_dnd (ScreenshotDialog *dialog)
g_return_if_fail (dialog != NULL);
- preview_darea = GTK_WIDGET (gtk_builder_get_object (dialog->ui, "preview_darea"));
+ preview_darea = GET_WIDGET ("preview_darea");
gtk_drag_source_set (preview_darea,
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
drag_types, G_N_ELEMENTS (drag_types),
@@ -297,7 +299,7 @@ screenshot_dialog_enable_dnd (ScreenshotDialog *dialog)
GtkWidget *
screenshot_dialog_get_toplevel (ScreenshotDialog *dialog)
{
- return GTK_WIDGET (gtk_builder_get_object (dialog->ui, "toplevel"));
+ return GET_WIDGET ("toplevel");
}
char *