diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-07-21 21:59:02 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-07-21 21:59:02 +0800 |
commit | e107a85dd6e6e65aca2e165df2ea6acc7cc99aff (patch) | |
tree | 1ad3cdf73bcc19e98b8ccb9f732471b3f7a57090 /shell/e-shell-folder-title-bar.c | |
parent | 31f6fc71f2b1095f0cb2423358c3da09f0e82121 (diff) | |
download | gsoc2013-evolution-e107a85dd6e6e65aca2e165df2ea6acc7cc99aff.tar.gz gsoc2013-evolution-e107a85dd6e6e65aca2e165df2ea6acc7cc99aff.tar.zst gsoc2013-evolution-e107a85dd6e6e65aca2e165df2ea6acc7cc99aff.zip |
Improve the title bar pop-up button: use a toggle button instead of a
regular one and allow sticking the pop-up with the close button (we'll
need to have it change the icon).
svn path=/trunk/; revision=4259
Diffstat (limited to 'shell/e-shell-folder-title-bar.c')
-rw-r--r-- | shell/e-shell-folder-title-bar.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/shell/e-shell-folder-title-bar.c b/shell/e-shell-folder-title-bar.c index 6078ecc59b..800e4d1074 100644 --- a/shell/e-shell-folder-title-bar.c +++ b/shell/e-shell-folder-title-bar.c @@ -48,7 +48,7 @@ struct _EShellFolderTitleBarPrivate { }; enum { - TITLE_CLICKED, + TITLE_TOGGLED, LAST_SIGNAL }; @@ -174,6 +174,7 @@ endarken_style (GtkWidget *widget) new_rc_style->fg[i].red = 0xffff; new_rc_style->fg[i].green = 0xffff; new_rc_style->fg[i].blue = 0xffff; + new_rc_style->color_flags[i] = GTK_RC_BG | GTK_RC_FG; } @@ -210,7 +211,7 @@ setup_style (EShellFolderTitleBar *folder_title_bar) priv = folder_title_bar->priv; - /* endarken_and_connect_style_set_signal (priv->button); */ + endarken_and_connect_style_set_signal (priv->button); endarken_and_connect_style_set_signal (priv->label); endarken_and_connect_style_set_signal (GTK_WIDGET (folder_title_bar)); } @@ -219,13 +220,15 @@ setup_style (EShellFolderTitleBar *folder_title_bar) /* Popup button callback. */ static void -title_button_clicked_cb (GtkButton *button, +title_button_toggled_cb (GtkToggleButton *button, void *data) { EShellFolderTitleBar *folder_title_bar; folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (data); - gtk_signal_emit (GTK_OBJECT (folder_title_bar), signals[TITLE_CLICKED]); + gtk_signal_emit (GTK_OBJECT (folder_title_bar), + signals[TITLE_TOGGLED], + gtk_toggle_button_get_active (button)); } @@ -301,12 +304,13 @@ class_init (EShellFolderTitleBarClass *klass) parent_class = gtk_type_class (PARENT_TYPE); - signals[TITLE_CLICKED] = gtk_signal_new ("title_clicked", + signals[TITLE_TOGGLED] = gtk_signal_new ("title_toggled", GTK_RUN_FIRST, object_class->type, - GTK_SIGNAL_OFFSET (EShellFolderTitleBarClass, title_clicked), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + GTK_SIGNAL_OFFSET (EShellFolderTitleBarClass, title_toggled), + gtk_marshal_NONE__BOOL, + GTK_TYPE_NONE, 1, + GTK_TYPE_BOOL); gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); } @@ -357,7 +361,7 @@ e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar) gtk_box_pack_start (GTK_BOX (button_hbox), priv->label, TRUE, TRUE, 0); gtk_widget_show (button_hbox); - priv->button = gtk_button_new (); + priv->button = gtk_toggle_button_new (); gtk_button_set_relief (GTK_BUTTON (priv->button), GTK_RELIEF_NONE); gtk_container_add (GTK_CONTAINER (priv->button), button_hbox); GTK_WIDGET_UNSET_FLAGS (priv->button, GTK_CAN_FOCUS); @@ -369,8 +373,8 @@ e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar) gtk_widget_show (priv->hbox); - gtk_signal_connect (GTK_OBJECT (priv->button), "clicked", - GTK_SIGNAL_FUNC (title_button_clicked_cb), folder_title_bar); + gtk_signal_connect (GTK_OBJECT (priv->button), "toggled", + GTK_SIGNAL_FUNC (title_button_toggled_cb), folder_title_bar); gtk_container_add (GTK_CONTAINER (folder_title_bar), priv->hbox); @@ -451,4 +455,19 @@ e_shell_folder_title_bar_set_icon (EShellFolderTitleBar *folder_title_bar, } +void +e_shell_folder_title_bar_set_toggle_state (EShellFolderTitleBar *folder_title_bar, + gboolean state) +{ + 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; + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), state); +} + + E_MAKE_TYPE (e_shell_folder_title_bar, "EShellFolderTitleBar", EShellFolderTitleBar, class_init, init, PARENT_TYPE) |