[gtk+/open-with-dialog: 43/52] open-with: move the "Show more applications" button in the dialog
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/open-with-dialog: 43/52] open-with: move the "Show more applications" button in the dialog
- Date: Tue, 23 Nov 2010 15:58:43 +0000 (UTC)
commit 2cb1b7e89160f632b8c1aeb9c8f483f39f64f9a8
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Nov 22 23:05:59 2010 +0100
open-with: move the "Show more applications" button in the dialog
It doesn't really belong in the widget now that we have the new states.
gtk/gtkopenwithdialog.c | 28 +++++++++++++++++++++++++++-
gtk/gtkopenwithwidget.c | 44 +-------------------------------------------
2 files changed, 28 insertions(+), 44 deletions(-)
---
diff --git a/gtk/gtkopenwithdialog.c b/gtk/gtkopenwithdialog.c
index 04b5827..fd0aca9 100644
--- a/gtk/gtkopenwithdialog.c
+++ b/gtk/gtkopenwithdialog.c
@@ -51,6 +51,7 @@ struct _GtkOpenWithDialogPrivate {
GtkWidget *open_label;
GtkWidget *open_with_widget;
+ GtkWidget *show_more_button;
};
enum {
@@ -267,12 +268,26 @@ set_dialog_properties (GtkOpenWithDialog *self)
}
static void
+show_more_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ GtkOpenWithDialog *self = user_data;
+
+ g_object_set (self->priv->open_with_widget,
+ "show-fallback", TRUE,
+ "show-other", TRUE,
+ NULL);
+
+ gtk_widget_hide (self->priv->show_more_button);
+}
+
+static void
build_dialog_ui (GtkOpenWithDialog *self)
{
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *label;
- GtkWidget *action_area;
+ GtkWidget *action_area, *button, *w;
gtk_container_set_border_width (GTK_CONTAINER (self), 5);
@@ -301,6 +316,17 @@ build_dialog_ui (GtkOpenWithDialog *self)
gtk_box_pack_start (GTK_BOX (vbox2), self->priv->open_with_widget, TRUE, TRUE, 0);
gtk_widget_show (self->priv->open_with_widget);
+ button = gtk_button_new_with_label (_("Show other applications"));
+ self->priv->show_more_button = button;
+ w = gtk_image_new_from_stock (GTK_STOCK_ADD,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), w);
+ gtk_box_pack_start (GTK_BOX (self->priv->open_with_widget), button, FALSE, FALSE, 6);
+ gtk_widget_show_all (button);
+
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (show_more_button_clicked_cb), self);
+
gtk_dialog_add_button (GTK_DIALOG (self),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
diff --git a/gtk/gtkopenwithwidget.c b/gtk/gtkopenwithwidget.c
index 8edeb6d..c25c2f7 100644
--- a/gtk/gtkopenwithwidget.c
+++ b/gtk/gtkopenwithwidget.c
@@ -49,12 +49,9 @@ struct _GtkOpenWithWidgetPrivate {
gboolean radio_mode;
GtkWidget *program_list;
- GtkWidget *show_more;
GtkListStore *program_list_store;
GtkCellRenderer *padding_renderer;
-
- gboolean show_more_clicked;
};
enum {
@@ -860,32 +857,6 @@ gtk_open_with_widget_get_property (GObject *object,
}
static void
-show_more_button_clicked_cb (GtkButton *button,
- gpointer user_data)
-{
- GtkOpenWithWidget *self = user_data;
-
- self->priv->show_more_clicked = TRUE;
- gtk_widget_hide (GTK_WIDGET (button));
-
- _gtk_open_with_widget_refilter (self);
-}
-
-static void
-gtk_open_with_widget_ensure_show_more_button (GtkOpenWithWidget *self)
-{
- if (self->priv->show_mode == GTK_OPEN_WITH_WIDGET_SHOW_MODE_HEADINGS)
- {
- if (!self->priv->show_more_clicked)
- gtk_widget_show (self->priv->show_more);
- }
- else
- {
- gtk_widget_hide (self->priv->show_more);
- }
-}
-
-static void
gtk_open_with_widget_constructed (GObject *object)
{
GtkOpenWithWidget *self = GTK_OPEN_WITH_WIDGET (object);
@@ -895,7 +866,6 @@ gtk_open_with_widget_constructed (GObject *object)
if (G_OBJECT_CLASS (gtk_open_with_widget_parent_class)->constructed != NULL)
G_OBJECT_CLASS (gtk_open_with_widget_parent_class)->constructed (object);
- gtk_open_with_widget_ensure_show_more_button (self);
gtk_open_with_widget_add_items (self);
}
@@ -999,7 +969,7 @@ gtk_open_with_widget_class_init (GtkOpenWithWidgetClass *klass)
static void
gtk_open_with_widget_init (GtkOpenWithWidget *self)
{
- GtkWidget *scrolled_window, *button, *w;
+ GtkWidget *scrolled_window;
GtkTreeSelection *selection;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTK_TYPE_OPEN_WITH_WIDGET,
@@ -1035,18 +1005,6 @@ gtk_open_with_widget_init (GtkOpenWithWidget *self)
g_signal_connect (self->priv->program_list, "button-press-event",
G_CALLBACK (program_list_button_press_event_cb),
self);
-
- button = gtk_button_new_with_label (_("Show other applications"));
- w = gtk_image_new_from_stock (GTK_STOCK_ADD,
- GTK_ICON_SIZE_BUTTON);
-
- gtk_button_set_image (GTK_BUTTON (button), w);
- gtk_box_pack_start (GTK_BOX (self), button, FALSE, FALSE, 6);
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (show_more_button_clicked_cb), self);
-
- self->priv->show_more = button;
}
static GAppInfo *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]