aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-07-21 21:59:02 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-07-21 21:59:02 +0800
commite107a85dd6e6e65aca2e165df2ea6acc7cc99aff (patch)
tree1ad3cdf73bcc19e98b8ccb9f732471b3f7a57090
parent31f6fc71f2b1095f0cb2423358c3da09f0e82121 (diff)
downloadgsoc2013-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
-rw-r--r--shell/ChangeLog12
-rw-r--r--shell/e-shell-folder-title-bar.c41
-rw-r--r--shell/e-shell-folder-title-bar.h19
-rw-r--r--shell/e-shell-view.c50
4 files changed, 98 insertions, 24 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 74768dc8a2..634668b681 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,17 @@
2000-07-21 Ettore Perazzoli <ettore@helixcode.com>
+ * e-shell-view.c (storage_set_view_box_button_release_event_cb):
+ Set the toggle state to FALSE on the title bar.
+
+ * e-shell-folder-title-bar.c: Signal "title_clicked" replaced by
+ "title_toggled".
+ (setup_style): Change the style for the button too.
+ (e_shell_folder_title_bar_construct): Use a GtkToggleButton, not a
+ GtkButton.
+ (e_shell_folder_title_bar_set_toggle_state): New.
+
+2000-07-21 Ettore Perazzoli <ettore@helixcode.com>
+
* e-shell-folder-title-bar.c (create_icon_pixmap): New. Create a
small arrow-shaped GtkPixmap.
(title_button_box_realize_cb): New. Callback for the "realize"
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)
diff --git a/shell/e-shell-folder-title-bar.h b/shell/e-shell-folder-title-bar.h
index 80258ad336..86759c8270 100644
--- a/shell/e-shell-folder-title-bar.h
+++ b/shell/e-shell-folder-title-bar.h
@@ -57,18 +57,19 @@ struct _EShellFolderTitleBarClass {
GtkEventBoxClass parent_class;
/* Signals. */
- void (* title_clicked) (EShellFolderTitleBar *folder_title_bar);
+ void (* title_toggled) (EShellFolderTitleBar *folder_title_bar, gboolean pressed);
};
-GtkType e_shell_folder_title_bar_get_type (void);
-void e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar);
-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_icon (EShellFolderTitleBar *folder_title_bar,
- const GdkPixbuf *icon);
+GtkType e_shell_folder_title_bar_get_type (void);
+void e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar);
+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_icon (EShellFolderTitleBar *folder_title_bar,
+ const GdkPixbuf *icon);
+void e_shell_folder_title_bar_set_toggle_state (EShellFolderTitleBar *folder_title_bar,
+ gboolean state);
#ifdef __cplusplus
}
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 8891013749..bd36c0df07 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -139,6 +139,8 @@ bonobo_widget_is_dead (BonoboWidget *bonobo_widget)
/* Folder bar pop-up handling. */
+static void disconnect_popup_signals (EShellView *shell_view);
+
static void
storage_set_view_box_button_release_event_cb (GtkWidget *widget,
GdkEventButton *button_event,
@@ -155,12 +157,46 @@ storage_set_view_box_button_release_event_cb (GtkWidget *widget,
e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN);
+ disconnect_popup_signals (shell_view);
+
+ e_shell_folder_title_bar_set_toggle_state (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), FALSE);
+}
+
+static void
+popup_storage_set_view_close_button_clicked (ETitleBar *title_bar,
+ void *data)
+{
+ EShellView *shell_view;
+ EShellViewPrivate *priv;
+
+ shell_view = E_SHELL_VIEW (data);
+ priv = shell_view->priv;
+
+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
+ gtk_grab_remove (priv->storage_set_view_box);
+
+ disconnect_popup_signals (shell_view);
+
+ e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_STICKY);
+ e_shell_folder_title_bar_set_toggle_state (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), FALSE);
+}
+
+static void
+disconnect_popup_signals (EShellView *shell_view)
+{
+ EShellViewPrivate *priv;
+
+ priv = shell_view->priv;
+
gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_view_box),
GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb),
shell_view);
gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_view),
GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb),
shell_view);
+ gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_title_bar),
+ GTK_SIGNAL_FUNC (popup_storage_set_view_close_button_clicked),
+ shell_view);
}
static void
@@ -190,6 +226,8 @@ storage_set_view_box_map_cb (GtkWidget *widget,
GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view);
gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "button_release_event",
GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view);
+ gtk_signal_connect (GTK_OBJECT (priv->storage_set_title_bar), "close_button_clicked",
+ GTK_SIGNAL_FUNC (popup_storage_set_view_close_button_clicked), shell_view);
}
static void
@@ -257,15 +295,19 @@ storage_set_view_close_button_clicked_cb (ETitleBar *title_bar,
e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN);
}
-/* Callback called when the title bar button has been clicked. */
+/* Callback called when the title bar button has been pressed. */
static void
-title_bar_clicked_cb (EShellFolderTitleBar *title_bar,
+title_bar_toggled_cb (EShellFolderTitleBar *title_bar,
+ gboolean state,
void *data)
{
EShellView *shell_view;
shell_view = E_SHELL_VIEW (data);
+ if (! state)
+ return;
+
if (e_shell_view_get_folder_bar_mode (shell_view) != E_SHELL_VIEW_SUBWINDOW_TRANSIENT)
pop_up_folder_bar (shell_view);
}
@@ -349,8 +391,8 @@ setup_widgets (EShellView *shell_view)
gtk_container_set_border_width (GTK_CONTAINER (priv->view_vbox), 2);
priv->view_title_bar = e_shell_folder_title_bar_new ();
- gtk_signal_connect (GTK_OBJECT (priv->view_title_bar), "title_clicked",
- GTK_SIGNAL_FUNC (title_bar_clicked_cb), shell_view);
+ gtk_signal_connect (GTK_OBJECT (priv->view_title_bar), "title_toggled",
+ GTK_SIGNAL_FUNC (title_bar_toggled_cb), shell_view);
priv->view_hpaned = e_hpaned_new ();
e_paned_add1 (E_PANED (priv->view_hpaned), priv->storage_set_view_box);