diff options
author | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-08-08 01:07:20 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-08-08 01:07:20 +0800 |
commit | 164d34f58d39f7b267b570ad3e467fff0bf49eb7 (patch) | |
tree | 036301e6374ec92e62c997ff452fec9afba706a8 | |
parent | a35fc005a66d9976f47526783412868db73ad867 (diff) | |
download | gsoc2013-epiphany-164d34f58d39f7b267b570ad3e467fff0bf49eb7.tar gsoc2013-epiphany-164d34f58d39f7b267b570ad3e467fff0bf49eb7.tar.gz gsoc2013-epiphany-164d34f58d39f7b267b570ad3e467fff0bf49eb7.tar.bz2 gsoc2013-epiphany-164d34f58d39f7b267b570ad3e467fff0bf49eb7.tar.lz gsoc2013-epiphany-164d34f58d39f7b267b570ad3e467fff0bf49eb7.tar.xz gsoc2013-epiphany-164d34f58d39f7b267b570ad3e467fff0bf49eb7.tar.zst gsoc2013-epiphany-164d34f58d39f7b267b570ad3e467fff0bf49eb7.zip |
*** empty log message ***
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | embed/mozilla/mozilla-notifiers.cpp | 4 | ||||
-rw-r--r-- | lib/egg/Makefile.am | 2 | ||||
-rw-r--r-- | lib/egg/egg-accel-dialog.c | 332 | ||||
-rw-r--r-- | lib/egg/egg-accel-dialog.h | 43 | ||||
-rw-r--r-- | lib/egg/egg-menu.h | 2 |
6 files changed, 11 insertions, 379 deletions
@@ -1,5 +1,12 @@ 2003-08-07 Marco Pesenti Gritti <marco@it.gnome.org> + * embed/mozilla/mozilla-notifiers.cpp: + + Dont set font prefs in mozilla when they are unset in + gconf. + +2003-08-07 Marco Pesenti Gritti <marco@it.gnome.org> + * lib/egg/Makefile.am: * lib/egg/egg-accel-dialog.c: * lib/egg/egg-accel-dialog.h: diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp index d8e63023d..e267d3423 100644 --- a/embed/mozilla/mozilla-notifiers.cpp +++ b/embed/mozilla/mozilla-notifiers.cpp @@ -245,6 +245,8 @@ mozilla_font_size_notifier (GConfClient *client, { char key[255]; + if (entry->value == NULL) return; + sprintf (key, "font.%s", pref); mozilla_prefs_set_int (key, eel_gconf_get_integer (entry->key)); @@ -314,6 +316,8 @@ mozilla_font_notifier (GConfClient *client, { char key[255]; char *name; + + if (entry->value == NULL) return; sprintf (key, "font.name.%s", pref); diff --git a/lib/egg/Makefile.am b/lib/egg/Makefile.am index a399d3c7c..eca7c0b14 100644 --- a/lib/egg/Makefile.am +++ b/lib/egg/Makefile.am @@ -14,7 +14,6 @@ EGGSOURCES = \ eggtreemultidnd.c \ egg-radio-action.c \ egg-menu-merge.c \ - egg-accel-dialog.c \ eggradiotoolbutton.c \ eggtoggletoolbutton.c \ eggtoolitem.c \ @@ -38,7 +37,6 @@ EGGHEADERS = \ egg-toggle-action.h \ egg-radio-action.h \ egg-menu-merge.h \ - egg-accel-dialog.h \ eggradiotoolbutton.h \ eggtoggletoolbutton.h \ eggtoolitem.h \ diff --git a/lib/egg/egg-accel-dialog.c b/lib/egg/egg-accel-dialog.c deleted file mode 100644 index 4173cbf02..000000000 --- a/lib/egg/egg-accel-dialog.c +++ /dev/null @@ -1,332 +0,0 @@ -#include "egg-accel-dialog.h" - -static void egg_accel_dialog_init (EggAccelDialog *self); -static void egg_accel_dialog_class_init (EggAccelDialogClass *class); - -GType -egg_accel_dialog_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GTypeInfo type_info = - { - sizeof (EggAccelDialogClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) egg_accel_dialog_class_init, - (GClassFinalizeFunc) NULL, - NULL, - - sizeof (EggAccelDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) egg_accel_dialog_init, - }; - - type = g_type_register_static (GTK_TYPE_DIALOG, - "EggAccelDialog", - &type_info, 0); - } - return type; -} - -static void -egg_accel_dialog_class_init (EggAccelDialogClass *class) -{ -} - -static void accel_path_selection_changed (GtkTreeSelection *selection, - EggAccelDialog *self); -static void accel_path_set (GtkWidget *button, EggAccelDialog *self); -static void accel_path_reset (GtkWidget *button, EggAccelDialog *self); - -static void -egg_accel_dialog_init (EggAccelDialog *self) -{ - GtkCellRenderer *renderer; - GtkWidget *swin; - GtkWidget *table; - - /* set up the list store for all the accelerators */ - self->accel_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); - gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self->accel_store), - 0, GTK_SORT_ASCENDING); - egg_accel_dialog_rescan_accels (self); - - - swin = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->vbox), swin, - TRUE, TRUE, 0); - gtk_widget_show (swin); - - /* set up a two column view of the model in browse selection mode */ - self->accel_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(self->accel_store)); - gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (self->accel_view), TRUE); - gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (self->accel_view)), - GTK_SELECTION_BROWSE); - g_signal_connect_object (gtk_tree_view_get_selection (GTK_TREE_VIEW (self->accel_view)), - "changed", G_CALLBACK (accel_path_selection_changed), - G_OBJECT (self), 0); - - renderer = gtk_cell_renderer_text_new (); - g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (self->accel_view), - -1, "Path", renderer, - "text", 0, - NULL); - gtk_tree_view_column_set_sort_column_id (gtk_tree_view_get_column (GTK_TREE_VIEW (self->accel_view), 0), 0); - - renderer = gtk_cell_renderer_text_new (); - g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (self->accel_view), - -1, "Accel", renderer, - "text", 1, - NULL); - gtk_tree_view_column_set_sort_column_id (gtk_tree_view_get_column (GTK_TREE_VIEW (self->accel_view), 1), 1); - - gtk_container_add (GTK_CONTAINER (swin), self->accel_view); - gtk_widget_show (self->accel_view); - - table = gtk_table_new (2, 4, FALSE); - gtk_container_set_border_width (GTK_CONTAINER (table), 2); - gtk_table_set_row_spacings (GTK_TABLE (table), 2); - gtk_table_set_col_spacings (GTK_TABLE (table), 2); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->vbox), table, FALSE,TRUE, 0); - gtk_widget_show (table); - - /* widgets for editing accels */ - self->shift_toggle = gtk_check_button_new_with_mnemonic ("S_hift"); - gtk_table_attach (GTK_TABLE (table), self->shift_toggle, - 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (self->shift_toggle); - self->ctrl_toggle = gtk_check_button_new_with_mnemonic ("_Ctrl"); - gtk_table_attach (GTK_TABLE (table), self->ctrl_toggle, - 1, 2, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (self->ctrl_toggle); - self->alt_toggle = gtk_check_button_new_with_mnemonic ("_Alt"); - gtk_table_attach (GTK_TABLE (table), self->alt_toggle, - 2, 3, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (self->alt_toggle); - self->key_entry = gtk_entry_new (); - gtk_table_attach (GTK_TABLE (table), self->key_entry, - 0, 3, 1, 2, - GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0); - gtk_widget_show (self->key_entry); - - /* buttons for changing path */ - self->set_button = gtk_button_new_with_mnemonic ("_Set"); - gtk_table_attach (GTK_TABLE (table), self->set_button, - 3, 4, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (self->set_button); - self->reset_button = gtk_button_new_with_mnemonic ("_Reset"); - gtk_table_attach (GTK_TABLE (table), self->reset_button, - 3, 4, 1, 2, - GTK_FILL, GTK_FILL, 0, 0); - /*gtk_widget_show (self->reset_button);*/ - - g_signal_connect_object (self->set_button, "clicked", - G_CALLBACK (accel_path_set), G_OBJECT (self), 0); - g_signal_connect_object (self->reset_button, "clicked", - G_CALLBACK (accel_path_reset), G_OBJECT (self), 0); - - - self->ok_button = gtk_dialog_add_button (GTK_DIALOG (self), - GTK_STOCK_OK, - GTK_RESPONSE_OK); - gtk_widget_grab_default (self->ok_button); -} - -static void -accel_map_foreach (gpointer data, - const gchar *accel_path, - guint accel_key, - guint accel_mods, - gboolean changed) -{ - EggAccelDialog *self = data; - GtkTreeIter iter; - gchar *accel_name; - - gtk_list_store_append (self->accel_store, &iter); - if (accel_key != 0) - accel_name = gtk_accelerator_name (accel_key, accel_mods); - else - accel_name = ""; - - gtk_list_store_set (self->accel_store, &iter, - 0, accel_path, - 1, accel_name, - -1); - if (accel_key != 0) - g_free(accel_name); -} - -void -egg_accel_dialog_rescan_accels (EggAccelDialog *self) -{ - g_return_if_fail (EGG_IS_ACCEL_DIALOG (self)); - - gtk_list_store_clear (self->accel_store); - gtk_accel_map_foreach (self, accel_map_foreach); -} - -/* make sure the currently selected accel is up to date */ -static void -refresh_selected_row (EggAccelDialog *self) -{ - GtkTreeSelection *selection; - GtkTreeIter iter; - - g_return_if_fail (EGG_IS_ACCEL_DIALOG (self)); - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->accel_view)); - if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { - char *accel_path; - - /* get the accel path for the selected row */ - gtk_tree_model_get (GTK_TREE_MODEL (self->accel_store), &iter, - 0, &accel_path, -1); - if (accel_path) { - GtkAccelKey key; - - if (gtk_accel_map_lookup_entry (accel_path, &key)) { - char *accel_name; - - accel_name = gtk_accelerator_name (key.accel_key, key.accel_mods); - gtk_list_store_set (self->accel_store, &iter, 1, accel_name, -1); - g_free (accel_name); - } - g_free (accel_path); - } - } -} - -static void -accel_path_selection_changed (GtkTreeSelection *selection, - EggAccelDialog *self) -{ - GtkTreeIter iter; - - /* just make sure the selected row is up to date */ - refresh_selected_row (self); - - if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { - char *accel_path; - - /* get the accel path for the selected row */ - gtk_tree_model_get (GTK_TREE_MODEL (self->accel_store), &iter, - 0, &accel_path, -1); - if (accel_path) { - GtkAccelKey key; - - if (gtk_accel_map_lookup_entry (accel_path, &key)) { - gchar *keyname; - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->shift_toggle), - (key.accel_mods & GDK_SHIFT_MASK)!=0); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->ctrl_toggle), - (key.accel_mods & GDK_CONTROL_MASK)!=0); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->alt_toggle), - (key.accel_mods & GDK_MOD1_MASK)!=0); - keyname = gdk_keyval_name (key.accel_key); - if (keyname) - gtk_entry_set_text (GTK_ENTRY (self->key_entry), keyname); - else - gtk_entry_set_text (GTK_ENTRY (self->key_entry), ""); - } - } - g_free (accel_path); - } -} - -static void -accel_path_set (GtkWidget *button, EggAccelDialog *self) -{ - GtkTreeSelection *selection; - GtkTreeIter iter; - gboolean changed = FALSE; - - g_return_if_fail (EGG_IS_ACCEL_DIALOG (self)); - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->accel_view)); - if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { - char *accel_path; - - /* get the accel path for the selected row */ - gtk_tree_model_get (GTK_TREE_MODEL (self->accel_store), &iter, - 0, &accel_path, -1); - if (accel_path) { - GdkModifierType accel_mods = 0; - const gchar *key_name; - guint accel_key = 0; - - /* get modifiers */ - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(self->shift_toggle))) - accel_mods |= GDK_SHIFT_MASK; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(self->ctrl_toggle))) - accel_mods |= GDK_CONTROL_MASK; - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(self->alt_toggle))) - accel_mods |= GDK_MOD1_MASK; - - key_name = gtk_entry_get_text (GTK_ENTRY (self->key_entry)); - /* check to see if entyr is empty -- if so, unset accel */ - if (key_name[0] != '\0') { - accel_key = gdk_keyval_from_name (key_name); - - if (accel_key) { - changed = gtk_accel_map_change_entry (accel_path, - accel_key, accel_mods, - TRUE); - } - } else - changed = gtk_accel_map_change_entry (accel_path, 0, 0, TRUE); - - g_free (accel_path); - } - } - if (!changed) - gdk_beep (); - accel_path_selection_changed (selection, self); -} - -static void -accel_path_reset (GtkWidget *button, EggAccelDialog *self) -{ - GtkTreeSelection *selection; - GtkTreeIter iter; - gboolean changed = FALSE; - - g_return_if_fail (EGG_IS_ACCEL_DIALOG (self)); - - g_message ("don't know how to reset to defaults :("); - return; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->accel_view)); - if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { - char *accel_path; - - /* get the accel path for the selected row */ - gtk_tree_model_get (GTK_TREE_MODEL (self->accel_store), &iter, - 0, &accel_path, -1); - if (accel_path) { - changed = gtk_accel_map_change_entry (accel_path, 0, 0, TRUE); - g_free (accel_path); - } - } - if (!changed) - gdk_beep (); - accel_path_selection_changed (selection, self); -} - -GtkWidget * -egg_accel_dialog_new (void) -{ - return g_object_new(EGG_TYPE_ACCEL_DIALOG, NULL); -} diff --git a/lib/egg/egg-accel-dialog.h b/lib/egg/egg-accel-dialog.h deleted file mode 100644 index 8aa2fc435..000000000 --- a/lib/egg/egg-accel-dialog.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef EGG_ACCEL_DIALOG_H -#define EGG_ACCEL_DIALOG_H - -#include <gtk/gtk.h> - -#define EGG_TYPE_ACCEL_DIALOG (egg_accel_dialog_get_type ()) -#define EGG_ACCEL_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_ACCEL_DIALOG, EggAccelDialog)) -#define EGG_ACCEL_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_ACCEL_DIALOG, EggAccelDialogClass)) -#define EGG_IS_ACCEL_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_ACCEL_DIALOG)) -#define EGG_IS_ACCEL_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EGG_TYPE_ACCEL_DIALOG)) -#define EGG_ACCEL_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_TYPE_ACCEL_DIALOG, EggAccelDialogClass)) - -typedef struct _EggAccelDialog EggAccelDialog; -typedef struct _EggAccelDialogClass EggAccelDialogClass; - -struct _EggAccelDialog { - GtkDialog parent; - - GtkListStore *accel_store; - - GtkWidget *accel_view; - - GtkWidget *shift_toggle; - GtkWidget *ctrl_toggle; - GtkWidget *alt_toggle; - GtkWidget *key_entry; - - GtkWidget *set_button; - GtkWidget *reset_button; - - GtkWidget *ok_button; -}; - -struct _EggAccelDialogClass { - GtkDialogClass parent_class; -}; - -GType egg_accel_dialog_get_type (void); -GtkWidget *egg_accel_dialog_new (void); - -void egg_accel_dialog_rescan_accels (EggAccelDialog *accel_dialog); - -#endif diff --git a/lib/egg/egg-menu.h b/lib/egg/egg-menu.h index eb71ef66d..ed6727944 100644 --- a/lib/egg/egg-menu.h +++ b/lib/egg/egg-menu.h @@ -8,6 +8,4 @@ #include <libegg/menu/egg-menu-merge.h> -#include <libegg/menu/egg-accel-dialog.h> - #endif |