[frogr] Move the 'Enable Tooltips' item from settings dialog to menu bar
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Move the 'Enable Tooltips' item from settings dialog to menu bar
- Date: Mon, 25 Apr 2011 03:59:59 +0000 (UTC)
commit 27a11a96ddc30d2fae67fec8fd526fc1c689de1c
Author: Mario Sanchez Prada <msanchez igalia com>
Date: Sun Apr 24 19:33:52 2011 -0700
Move the 'Enable Tooltips' item from settings dialog to menu bar
src/frogr-main-view.c | 38 ++++++++++++++++++++++++++++++++++++++
src/frogr-settings-dialog.c | 23 -----------------------
2 files changed, 38 insertions(+), 23 deletions(-)
---
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index acbb279..76e7c51 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -68,7 +68,10 @@ G_DEFINE_TYPE (FrogrMainView, frogr_main_view, G_TYPE_OBJECT)
typedef struct _FrogrMainViewPrivate {
FrogrMainViewModel *model;
FrogrController *controller;
+
FrogrConfig *config;
+ gboolean tooltips_enabled;
+
GtkWindow *window;
GtkWidget *menu_bar;
@@ -109,6 +112,7 @@ typedef struct _FrogrMainViewPrivate {
GtkWidget *sort_by_date_asc_ctxt_menu_item;
GtkWidget *sort_by_date_desc_menu_item;
GtkWidget *sort_by_date_desc_ctxt_menu_item;
+ GtkWidget *enable_tooltips_menu_item;
GtkWidget *about_menu_item;
GtkWidget *pictures_ctxt_menu;
@@ -161,6 +165,7 @@ gboolean _on_icon_view_button_press_event (GtkWidget *widget,
gpointer data);
void _on_menu_item_activate (GtkWidget *widget, gpointer self);
+void _on_check_menu_item_toggled (GtkCheckMenuItem *item, gpointer self);
static gboolean _on_main_view_delete_event (GtkWidget *widget,
GdkEvent *event,
@@ -437,6 +442,16 @@ _populate_menu_bar (FrogrMainView *self)
self);
priv->sort_by_date_desc_menu_item = menu_item;
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_separator_menu_item_new ());
+
+ menu_item = gtk_check_menu_item_new_with_mnemonic (_("Enable _Tooltips"));
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), priv->tooltips_enabled);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ g_signal_connect (G_OBJECT (menu_item), "toggled",
+ G_CALLBACK (_on_check_menu_item_toggled),
+ self);
+ priv->enable_tooltips_menu_item = menu_item;
+
/* Help menu */
#ifndef MAC_INTEGRATION
@@ -894,6 +909,26 @@ _on_menu_item_activate (GtkWidget *widget, gpointer self)
frogr_controller_show_about_dialog (priv->controller);
}
+void
+_on_check_menu_item_toggled (GtkCheckMenuItem *item, gpointer self)
+{
+ FrogrMainView *mainview = NULL;
+ FrogrMainViewPrivate *priv = NULL;
+
+ mainview = FROGR_MAIN_VIEW (self);
+ priv = FROGR_MAIN_VIEW_GET_PRIVATE (mainview);
+
+ if (GTK_WIDGET (item) == priv->enable_tooltips_menu_item)
+ {
+ gboolean enable = gtk_check_menu_item_get_active (item);
+ frogr_config_set_enable_tooltips (priv->config, enable);
+ priv->tooltips_enabled = enable;
+ }
+
+ /* State for check menu items should be immediately stored */
+ frogr_config_save_settings (priv->config);
+}
+
static gboolean
_on_main_view_delete_event (GtkWidget *widget,
GdkEvent *event,
@@ -1775,6 +1810,9 @@ frogr_main_view_init (FrogrMainView *self)
upload_button = GTK_WIDGET (gtk_builder_get_object (builder, "upload_button"));
priv->upload_button = upload_button;
+ /* Read value for 'tooltips enabled' */
+ priv->tooltips_enabled = frogr_config_get_enable_tooltips (priv->config);
+
/* initialize extra widgets */
/* populate menubar with items and submenus */
diff --git a/src/frogr-settings-dialog.c b/src/frogr-settings-dialog.c
index a347695..7057ffc 100644
--- a/src/frogr-settings-dialog.c
+++ b/src/frogr-settings-dialog.c
@@ -55,7 +55,6 @@ typedef struct _FrogrSettingsDialogPrivate {
GtkWidget *restricted_rb;
GtkWidget *tags_autocompletion_cb;
GtkWidget *remove_file_extensions_cb;
- GtkWidget *enable_tooltips_cb;
GtkWidget *use_proxy_cb;
GtkWidget *proxy_host_label;
@@ -73,7 +72,6 @@ typedef struct _FrogrSettingsDialogPrivate {
gboolean show_in_search;
gboolean tags_autocompletion;
gboolean remove_file_extensions;
- gboolean enable_tooltips;
FspSafetyLevel safety_level;
FspContentType content_type;
@@ -288,14 +286,6 @@ _add_general_page (FrogrSettingsDialog *self, GtkNotebook *notebook)
box1 = gtk_vbox_new (FALSE, 6);
- cbutton = gtk_check_button_new_with_mnemonic (_("Enable Tooltips in Main Window"));
- gtk_box_pack_start (GTK_BOX (box1), cbutton, FALSE, FALSE, 0);
- priv->enable_tooltips_cb = cbutton;
-
- g_signal_connect (G_OBJECT (priv->enable_tooltips_cb), "toggled",
- G_CALLBACK (_on_button_toggled),
- self);
-
cbutton = gtk_check_button_new_with_mnemonic (_("Ena_ble Tags Auto-Completion"));
gtk_box_pack_start (GTK_BOX (box1), cbutton, FALSE, FALSE, 0);
priv->tags_autocompletion_cb = cbutton;
@@ -444,7 +434,6 @@ _fill_dialog_with_data (FrogrSettingsDialog *self)
priv->safety_level = frogr_config_get_default_safety_level (priv->config);
priv->tags_autocompletion = frogr_config_get_tags_autocompletion (priv->config);
priv->remove_file_extensions = frogr_config_get_remove_file_extensions (priv->config);
- priv->enable_tooltips = frogr_config_get_enable_tooltips (priv->config);
priv->use_proxy = frogr_config_get_use_proxy (priv->config);
g_free (priv->proxy_host);
@@ -500,9 +489,6 @@ _fill_dialog_with_data (FrogrSettingsDialog *self)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->remove_file_extensions_cb),
priv->remove_file_extensions);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->enable_tooltips_cb),
- priv->enable_tooltips);
-
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_proxy_cb),
priv->use_proxy);
if (priv->proxy_host)
@@ -538,7 +524,6 @@ _save_data (FrogrSettingsDialog *self)
frogr_config_set_tags_autocompletion (priv->config, priv->tags_autocompletion);
frogr_config_set_remove_file_extensions (priv->config, priv->remove_file_extensions);
- frogr_config_set_enable_tooltips (priv->config, priv->enable_tooltips);
frogr_config_set_use_proxy (priv->config, priv->use_proxy);
@@ -676,12 +661,6 @@ _on_button_toggled (GtkToggleButton *button, gpointer data)
DEBUG ("Remove file extensions before upload set to %s", active ? "TRUE" : "FALSE");
}
- if (GTK_WIDGET (button) == priv->enable_tooltips_cb)
- {
- priv->enable_tooltips = active;
- DEBUG ("Enable Tooltips in Main Window set to %s", active ? "TRUE" : "FALSE");
- }
-
if (GTK_WIDGET (button) == priv->use_proxy_cb)
{
priv->use_proxy = active;
@@ -806,7 +785,6 @@ frogr_settings_dialog_init (FrogrSettingsDialog *self)
priv->restricted_rb = NULL;
priv->tags_autocompletion_cb = NULL;
priv->remove_file_extensions_cb = NULL;
- priv->enable_tooltips_cb = NULL;
priv->use_proxy_cb = NULL;
priv->proxy_host_label = NULL;
priv->proxy_host_entry = NULL;
@@ -824,7 +802,6 @@ frogr_settings_dialog_init (FrogrSettingsDialog *self)
priv->content_type = FSP_CONTENT_TYPE_NONE;
priv->tags_autocompletion = FALSE;
priv->remove_file_extensions = FALSE;
- priv->enable_tooltips = FALSE;
priv->use_proxy = FALSE;
priv->proxy_host = NULL;
priv->proxy_port = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]