From 65460ea5357a9f5638d3f6d816a97a9428971f31 Mon Sep 17 00:00:00 2001 From: Jason Leach Date: Thu, 31 May 2001 00:24:59 +0000 Subject: New function (probably should just be static). 2001-05-30 Jason Leach * e-shell-view.c (e_shell_view_set_current_shortcuts_group_num): New function (probably should just be static). (e_shell_view_load_settings): Load the current shortcut group here using the above new function. (e_shell_view_save_settings): Save current shortcut group in here. 2001-05-30 Jason Leach * e-shell-folder-title-bar.c: New 'folder_bar_label' member for EShellFolderTitleBar, it's for information that's shown to the left of the icon like the dates in the calendar (or, potentially total and unread numbers for mailer). (e_shell_folder_title_bar_set_folder_bar_label): New function, lets others set the title bar extra label. * Evolution-ShellView.idl: New method 'setFolderBarLabel' for our exposed ShellView interface. * evolution-shell-view.c (class_init): New signal "set_folder_bar_label" for EvolutionShellViewClass. * evolution-shell-view.c (impl_ShellView_set_folder_bar_label): Emit the new signal here. * e-shell-view.c (setup_corba_interface): Connect the signal here. * e-shell-view.c (corba_interface_set_folder_bar_label): New function, callback for the above signals, does the actual extra label setting for the folder title bar. * e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar): Fix a warning here. svn path=/trunk/; revision=10059 --- shell/ChangeLog | 35 +++++++++++++++++++++++++++ shell/Evolution-ShellView.idl | 1 + shell/e-shell-folder-commands.c | 2 +- shell/e-shell-folder-title-bar.c | 49 +++++++++++++++++++++++++++++++++----- shell/e-shell-folder-title-bar.h | 2 ++ shell/e-shell-view.c | 39 ++++++++++++++++++++++++++++++ shell/e-shell-view.h | 3 +++ shell/evolution-shell-view.c | 23 ++++++++++++++++++ shell/evolution-shell-view.h | 1 + shell/evolution-storage-listener.c | 10 ++++---- shell/evolution-storage.c | 2 +- 11 files changed, 154 insertions(+), 13 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 3306a23b40..ff411da114 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,38 @@ +2001-05-30 Jason Leach + + * e-shell-view.c (e_shell_view_set_current_shortcuts_group_num): + New function (probably should just be static). + (e_shell_view_load_settings): Load the current shortcut group here + using the above new function. + (e_shell_view_save_settings): Save current shortcut group in here. + +2001-05-30 Jason Leach + + * e-shell-folder-title-bar.c: New 'folder_bar_label' member for + EShellFolderTitleBar, it's for information that's shown to the + left of the icon like the dates in the calendar (or, potentially + total and unread numbers for mailer). + (e_shell_folder_title_bar_set_folder_bar_label): New function, + lets others set the title bar extra label. + + * Evolution-ShellView.idl: New method 'setFolderBarLabel' for our + exposed ShellView interface. + + * evolution-shell-view.h: New signal "set_folder_bar_label" for + EvolutionShellView. + + * evolution-shell-view.c (impl_ShellView_set_message): Emit the + new signal here. + + * e-shell-view.c (setup_corba_interface): Connect the signal here. + + * e-shell-view.c (corba_interface_set_folder_bar_label): New + function, callback for the above signals, does the actual extra + label setting for the folder title bar. + + * e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar): + Fix a warning here. + 2001-05-30 Jason Leach * e-shell.c (e_shell_construct): Removed an unecessary sleep(2) diff --git a/shell/Evolution-ShellView.idl b/shell/Evolution-ShellView.idl index 0da2540528..685604e601 100644 --- a/shell/Evolution-ShellView.idl +++ b/shell/Evolution-ShellView.idl @@ -18,6 +18,7 @@ module Evolution { void unsetMessage (); void changeCurrentView (in string uri); void setTitle (in string title); + void setFolderBarLabel (in string text); }; }; }; diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c index f0a39f0e4e..6843c89da4 100644 --- a/shell/e-shell-folder-commands.c +++ b/shell/e-shell-folder-commands.c @@ -316,7 +316,7 @@ e_shell_command_add_to_shortcut_bar (EShell *shell, { EShortcuts *shortcuts; int group_num; - char *uri; + const char *uri; g_return_if_fail (shell != NULL); g_return_if_fail (E_IS_SHELL (shell)); diff --git a/shell/e-shell-folder-title-bar.c b/shell/e-shell-folder-title-bar.c index 2ad59f507f..514d5141ac 100644 --- a/shell/e-shell-folder-title-bar.c +++ b/shell/e-shell-folder-title-bar.c @@ -50,15 +50,19 @@ struct _EShellFolderTitleBarPrivate { GdkPixbuf *icon; GtkWidget *icon_widget; - /* The hbox containing the button, the label and the icon on the right. */ + /* The hbox containing the button, the label, the extra label, and the icon on the right. */ GtkWidget *hbox; - /* We have a label and a button. When the button is enabled, the label is hidden; - when the button is disable, only the label is visible. */ + /* We have a label and a button. When the button is enabled, + the label is hidden; when the button is disable, only the + label is visible. */ /* The label. */ GtkWidget *label; + /* Holds extra information that is to be shown to the left of the icon */ + GtkWidget *folder_bar_label; + /* The button. */ GtkWidget *button; GtkWidget *button_label; @@ -269,8 +273,8 @@ realize (GtkWidget *widget) gtk_widget_show (priv->icon_widget); gtk_misc_set_alignment (GTK_MISC (priv->icon_widget), 1.0, .5); - gtk_misc_set_padding (GTK_MISC (priv->icon_widget), 5, 0); - gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_widget, TRUE, TRUE, 2); + gtk_misc_set_padding (GTK_MISC (priv->icon_widget), 0, 0); + gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_widget, FALSE, FALSE, 2); } static void @@ -345,6 +349,7 @@ init (EShellFolderTitleBar *shell_folder_title_bar) priv->icon_widget = NULL; priv->hbox = NULL; priv->label = NULL; + priv->folder_bar_label = NULL; priv->button_label = NULL; priv->button = NULL; priv->button_arrow = NULL; @@ -375,9 +380,12 @@ e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar) widget = GTK_WIDGET (folder_title_bar); priv->label = gtk_label_new (""); - gtk_misc_set_padding (GTK_MISC (priv->label), 5, 0); gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5); + priv->folder_bar_label = gtk_label_new (""); + gtk_misc_set_alignment (GTK_MISC (priv->folder_bar_label), 1.0, 0.5); + gtk_widget_show (priv->folder_bar_label); + priv->button_label = gtk_label_new (""); gtk_misc_set_padding (GTK_MISC (priv->button_label), 5, 0); gtk_misc_set_alignment (GTK_MISC (priv->button_label), 0.0, 0.5); @@ -399,6 +407,7 @@ e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar) gtk_container_set_border_width (GTK_CONTAINER (priv->hbox), 2); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->button, FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (priv->hbox), priv->folder_bar_label, TRUE, TRUE, 0); gtk_widget_show (priv->hbox); @@ -467,6 +476,34 @@ e_shell_folder_title_bar_set_title (EShellFolderTitleBar *folder_title_bar, gtk_widget_queue_draw (GTK_WIDGET (folder_title_bar)); } +/** + * e_shell_folder_title_bar_set_folder_bar_label: + * @folder_title_bar: + * @text: Some text to show in the label. + * + * Sets the right-justified text label (to the left of the icon) for + * the title bar. + **/ +void +e_shell_folder_title_bar_set_folder_bar_label (EShellFolderTitleBar *folder_title_bar, + const char *text) +{ + EShellFolderTitleBarPrivate *priv; + + g_return_if_fail (folder_title_bar != NULL); + g_return_if_fail (E_IS_SHELL_FOLDER_TITLE_BAR (folder_title_bar)); + + priv = folder_title_bar->priv; + + if (text == NULL) + gtk_label_set_text (GTK_LABEL (priv->folder_bar_label), ""); + else + gtk_label_set_text (GTK_LABEL (priv->folder_bar_label), text); + + /* FIXME: Might want to set the styles somewhere in here too, + black text on grey background isn't the best combination */ +} + /** * e_shell_folder_title_bar_set_icon: * @folder_title_bar: diff --git a/shell/e-shell-folder-title-bar.h b/shell/e-shell-folder-title-bar.h index f6eef54bbf..092a465f14 100644 --- a/shell/e-shell-folder-title-bar.h +++ b/shell/e-shell-folder-title-bar.h @@ -63,6 +63,8 @@ GtkWidget *e_shell_folder_title_bar_new (void); void e_shell_folder_title_bar_set_title (EShellFolderTitleBar *folder_title_bar, const char *title); +void e_shell_folder_title_bar_set_folder_bar_label (EShellFolderTitleBar *folder_title_bar, + const char *folder_bar_label); void e_shell_folder_title_bar_set_icon (EShellFolderTitleBar *folder_title_bar, const GdkPixbuf *icon); void e_shell_folder_title_bar_set_toggle_state (EShellFolderTitleBar *folder_title_bar, diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 6bd47ebcf7..7166a50454 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -677,6 +677,20 @@ setup_progress_bar (EShellView *shell_view) bonobo_object_unref (BONOBO_OBJECT (control)); } +void +e_shell_view_set_current_shortcuts_group_num (EShellView *shell_view, int group_num) +{ + /* This function could become static */ + EShellViewPrivate *priv; + EShortcutsView *shortcuts_view; + + priv = shell_view->priv; + + shortcuts_view = E_SHORTCUTS_VIEW (priv->shortcut_bar); + + e_group_bar_set_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view)), group_num, FALSE); +} + int e_shell_view_get_current_shortcuts_group_num (EShellView *shell_view) { @@ -1081,6 +1095,24 @@ corba_interface_set_title (EvolutionShellView *shell_view, gtk_window_set_title (GTK_WINDOW (view), title); } +static void +corba_interface_set_folder_bar_label (EvolutionShellView *shell_view, + const char *text, + void *data) +{ + EShellView *shell_view; + EShellViewPrivate *priv; + + g_return_if_fail (data != NULL); + g_return_if_fail (E_IS_SHELL_VIEW (data)); + + shell_view = E_SHELL_VIEW (data); + priv = shell_view->priv; + + e_shell_folder_title_bar_set_folder_bar_label (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), + text); +} + static void unmerge_on_error (BonoboObject *object, CORBA_Object cobject, @@ -1474,6 +1506,9 @@ setup_corba_interface (EShellView *shell_view, gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_title", GTK_SIGNAL_FUNC (corba_interface_set_title), shell_view, GTK_OBJECT (shell_view)); + gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_folder_bar_label", + GTK_SIGNAL_FUNC (corba_interface_set_folder_bar_label), + shell_view, GTK_OBJECT (shell_view)); bonobo_object_add_interface (BONOBO_OBJECT (control_frame), BONOBO_OBJECT (corba_interface)); @@ -2069,6 +2104,7 @@ e_shell_view_save_settings (EShellView *shell_view, gnome_config_push_prefix (prefix); + gnome_config_set_int ("CurrentShortcutsGroupNum", e_shell_view_get_current_shortcuts_group_num (shell_view)); gnome_config_set_int ("FolderBarMode", e_shell_view_get_folder_bar_mode (shell_view)); gnome_config_set_int ("ShortcutBarMode", e_shell_view_get_shortcut_bar_mode (shell_view)); gnome_config_set_int ("HPanedPosition", e_paned_get_position (E_PANED (priv->hpaned))); @@ -2119,6 +2155,9 @@ e_shell_view_load_settings (EShellView *shell_view, gnome_config_push_prefix (prefix); + val = gnome_config_get_int ("CurrentShortcutsGroupNum"); + e_shell_view_set_current_shortcuts_group_num (shell_view, val); + val = gnome_config_get_int ("FolderBarMode"); e_shell_view_set_folder_bar_mode (shell_view, val); diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index 804379b1c0..605691b46d 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -84,13 +84,16 @@ void e_shell_view_set_folder_bar_mode (EShellView EShellViewSubwindowMode mode); EShellViewSubwindowMode e_shell_view_get_folder_bar_mode (EShellView *shell_view); + EShell *e_shell_view_get_shell (EShellView *shell_view); BonoboUIComponent *e_shell_view_get_bonobo_ui_component (EShellView *shell_view); BonoboUIContainer *e_shell_view_get_bonobo_ui_container (EShellView *shell_view); GtkWidget *e_shell_view_get_appbar (EShellView *shell_view); const char *e_shell_view_get_current_uri (EShellView *shell_view); const char *e_shell_view_get_current_path (EShellView *shell_view); + int e_shell_view_get_current_shortcuts_group_num (EShellView *shell_view); +void e_shell_view_set_current_shortcuts_group_num (EShellView *shell_view, int group_num); gboolean e_shell_view_save_settings (EShellView *shell_view, const char *prefix); diff --git a/shell/evolution-shell-view.c b/shell/evolution-shell-view.c index 82e471c35f..e5a377afe0 100644 --- a/shell/evolution-shell-view.c +++ b/shell/evolution-shell-view.c @@ -44,6 +44,7 @@ enum { UNSET_MESSAGE, CHANGE_VIEW, SET_TITLE, + SET_FOLDER_BAR_LABEL, LAST_SIGNAL }; static int signals[LAST_SIGNAL] = { 0 }; @@ -121,6 +122,18 @@ impl_ShellView_set_title (PortableServer_Servant servant, title); } +static void +impl_ShellView_set_folder_bar_label (PortableServer_Servant servant, + const CORBA_char *text, + CORBA_Environment *ev) +{ + BonoboObject *bonobo_object; + + bonobo_object = bonobo_object_from_servant (servant); + gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[SET_FOLDER_BAR_LABEL], + text); +} + /* GtkObject methods. */ static void @@ -155,6 +168,7 @@ corba_class_init (void) epv->unsetMessage = impl_ShellView_unset_message; epv->changeCurrentView = impl_ShellView_change_current_view; epv->setTitle = impl_ShellView_set_title; + epv->setFolderBarLabel = impl_ShellView_set_folder_bar_label; vepv = &ShellView_vepv; vepv->_base_epv = base_epv; @@ -206,6 +220,15 @@ class_init (EvolutionShellViewClass *klass) GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + signals[SET_FOLDER_BAR_LABEL] + = gtk_signal_new ("set_folder_bar_label", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EvolutionShellViewClass, set_folder_bar_label), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_STRING); + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); parent_class = gtk_type_class (bonobo_object_get_type ()); diff --git a/shell/evolution-shell-view.h b/shell/evolution-shell-view.h index f7e58a316b..0f2fc64267 100644 --- a/shell/evolution-shell-view.h +++ b/shell/evolution-shell-view.h @@ -59,6 +59,7 @@ struct _EvolutionShellViewClass { void (* unset_message) (EvolutionShellView *shell_view); void (* change_current_view) (EvolutionShellView *shell_view, const char *uri); void (* set_title) (EvolutionShellView *shell_view, const char *message); + void (* set_folder_bar_label) (EvolutionShellView *shell_view, const char *text); }; diff --git a/shell/evolution-storage-listener.c b/shell/evolution-storage-listener.c index 0d8ca46609..0da33fda2a 100644 --- a/shell/evolution-storage-listener.c +++ b/shell/evolution-storage-listener.c @@ -42,11 +42,11 @@ struct _EvolutionStorageListenerPrivate { enum { - DESTROYED, - NEW_FOLDER, - UPDATE_FOLDER, - REMOVED_FOLDER, - LAST_SIGNAL + DESTROYED, + NEW_FOLDER, + UPDATE_FOLDER, + REMOVED_FOLDER, + LAST_SIGNAL }; static guint signals[LAST_SIGNAL] = { 0 }; diff --git a/shell/evolution-storage.c b/shell/evolution-storage.c index e965c71a2a..482e25c834 100644 --- a/shell/evolution-storage.c +++ b/shell/evolution-storage.c @@ -515,7 +515,7 @@ init (EvolutionStorage *storage) priv->toplevel_node_uri = NULL; priv->toplevel_node_type = NULL; priv->folder_tree = e_folder_tree_new (folder_destroy_notify, storage); - priv->uri_to_path = g_hash_table_new (g_str_hash, g_str_equal); + priv->uri_to_path = g_hash_table_new (g_str_hash, g_str_equal); priv->corba_storage_listeners = NULL; storage->priv = priv; -- cgit v1.2.3