[glade/ui-incubator] Replaced buttons with 3 dots [...] for a secondary edit icon in the entry itself.
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/ui-incubator] Replaced buttons with 3 dots [...] for a secondary edit icon in the entry itself.
- Date: Wed, 31 Oct 2012 20:05:16 +0000 (UTC)
commit f2824d23777783216e0dbb1c4fc9f81674cd1b0a
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Tue Oct 23 16:02:10 2012 -0700
Replaced buttons with 3 dots [...] for a secondary edit icon in the entry itself.
gladeui/glade-editor-property.c | 168 +++++++++++++++++----------------------
plugins/gtk+/glade-accels.c | 23 ++----
2 files changed, 81 insertions(+), 110 deletions(-)
---
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 6be0a60..556fcf1 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -1110,8 +1110,9 @@ glade_eprop_flags_create_treeview (GladeEditorProperty *eprop)
}
static void
-glade_eprop_flags_show_dialog (GtkWidget *button, GladeEditorProperty *eprop)
+glade_eprop_flags_show_dialog (GladeEditorProperty *eprop)
{
+ GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
GtkWidget *dialog;
GtkWidget *view;
GtkWidget *label;
@@ -1120,9 +1121,10 @@ glade_eprop_flags_show_dialog (GtkWidget *button, GladeEditorProperty *eprop)
GtkWidget *action_area;
dialog = gtk_dialog_new_with_buttons (_("Select Fields"),
- GTK_WINDOW (gtk_widget_get_toplevel
- (button)), GTK_DIALOG_MODAL,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+ GTK_WINDOW (window),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE,
NULL);
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400);
@@ -1162,7 +1164,6 @@ glade_eprop_flags_show_dialog (GtkWidget *button, GladeEditorProperty *eprop)
static GtkWidget *
glade_eprop_flags_create_input (GladeEditorProperty *eprop)
{
- GtkWidget *hbox, *button;
GladeEPropFlags *eprop_flags = GLADE_EPROP_FLAGS (eprop);
if (!eprop_flags->model)
@@ -1170,24 +1171,17 @@ glade_eprop_flags_create_input (GladeEditorProperty *eprop)
G_TYPE_STRING,
G_TYPE_UINT));
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-
eprop_flags->entry = gtk_entry_new ();
gtk_editable_set_editable (GTK_EDITABLE (eprop_flags->entry), FALSE);
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_flags->entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_EDIT);
- gtk_box_pack_start (GTK_BOX (hbox), eprop_flags->entry, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("...");
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-
- gtk_widget_show_all (eprop_flags->entry);
- gtk_widget_show_all (button);
-
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (glade_eprop_flags_show_dialog), eprop);
+ g_signal_connect_swapped (eprop_flags->entry, "icon-release",
+ G_CALLBACK (glade_eprop_flags_show_dialog),
+ eprop);
- return hbox;
+ return eprop_flags->entry;
}
/*******************************************************************************
@@ -1474,8 +1468,7 @@ chooser_response (GladeNamedIconChooserDialog *dialog,
}
static void
-glade_eprop_named_icon_show_chooser_dialog (GtkWidget *button,
- GladeEditorProperty *eprop)
+glade_eprop_named_icon_show_chooser_dialog (GladeEditorProperty *eprop)
{
GtkWidget *dialog;
@@ -1513,33 +1506,26 @@ static GtkWidget *
glade_eprop_named_icon_create_input (GladeEditorProperty *eprop)
{
GladeEPropNamedIcon *eprop_named_icon = GLADE_EPROP_NAMED_ICON (eprop);
- GtkWidget *hbox;
- GtkWidget *button;
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER);
eprop_named_icon->entry = gtk_entry_new ();
- gtk_widget_show (eprop_named_icon->entry);
+ gtk_widget_set_valign (eprop_named_icon->entry, GTK_ALIGN_CENTER);
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_named_icon->entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_EDIT);
eprop_named_icon->current_context = NULL;
- gtk_box_pack_start (GTK_BOX (hbox), eprop_named_icon->entry, TRUE, TRUE, 0);
-
g_signal_connect (G_OBJECT (eprop_named_icon->entry), "activate",
G_CALLBACK (glade_eprop_named_icon_activate), eprop);
g_signal_connect (G_OBJECT (eprop_named_icon->entry), "focus-out-event",
G_CALLBACK (glade_eprop_named_icon_focus_out), eprop);
- button = gtk_button_new_with_label ("\342\200\246");
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
- g_signal_connect (button, "clicked",
- G_CALLBACK (glade_eprop_named_icon_show_chooser_dialog),
- eprop);
+ g_signal_connect_swapped (eprop_named_icon->entry, "icon-release",
+ G_CALLBACK (glade_eprop_named_icon_show_chooser_dialog),
+ eprop);
- return hbox;
+ return eprop_named_icon->entry;
}
@@ -1949,8 +1935,7 @@ glade_editor_property_show_i18n_dialog (GtkWidget *parent,
}
static void
-glade_eprop_text_show_i18n_dialog (GtkWidget *entry,
- GladeEditorProperty *eprop)
+glade_eprop_text_show_i18n_dialog (GladeEditorProperty *eprop)
{
gchar *text = glade_property_make_string (eprop->priv->property);
gchar *context = g_strdup (glade_property_i18n_get_context (eprop->priv->property));
@@ -1959,7 +1944,7 @@ glade_eprop_text_show_i18n_dialog (GtkWidget *entry,
glade_property_i18n_get_translatable (eprop->priv->property);
if (glade_editor_property_show_i18n_dialog
- (entry, &text, &context, &comment, &translatable))
+ (GTK_WIDGET (eprop), &text, &context, &comment, &translatable))
{
glade_command_set_i18n (eprop->priv->property, translatable, context, comment);
glade_eprop_text_changed_common (eprop, text, eprop->priv->use_command);
@@ -2029,14 +2014,13 @@ glade_editor_property_show_resource_dialog (GladeProject *project,
}
static void
-glade_eprop_text_show_resource_dialog (GtkWidget *entry,
- GladeEditorProperty *eprop)
+glade_eprop_text_show_resource_dialog (GladeEditorProperty *eprop)
{
GladeWidget *widget = glade_property_get_widget (eprop->priv->property);
GladeProject *project = glade_widget_get_project (widget);
gchar *text = NULL;
- if (glade_editor_property_show_resource_dialog (project, entry, &text))
+ if (glade_editor_property_show_resource_dialog (project, GTK_WIDGET (eprop), &text))
{
glade_eprop_text_changed_common (eprop, text, eprop->priv->use_command);
@@ -2174,7 +2158,7 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop)
GtkTextBuffer *buffer;
swindow = gtk_scrolled_window_new (NULL, NULL);
-
+ gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (swindow), 128);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
@@ -2199,36 +2183,46 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop)
eprop_text->text_entry = gtk_entry_new ();
gtk_widget_show (eprop_text->text_entry);
- gtk_box_pack_start (GTK_BOX (hbox), eprop_text->text_entry, TRUE, TRUE,
- 0);
+ gtk_box_pack_start (GTK_BOX (hbox), eprop_text->text_entry, TRUE, TRUE, 0);
g_signal_connect (G_OBJECT (eprop_text->text_entry), "changed",
G_CALLBACK (glade_eprop_text_changed), eprop);
if (pspec->value_type == GDK_TYPE_PIXBUF)
{
- GtkWidget *image =
- gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
- GtkWidget *button = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (button), image);
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (glade_eprop_text_show_resource_dialog),
- eprop);
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_text->text_entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_OPEN);
- gtk_widget_show_all (button);
-
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+ g_signal_connect_swapped (eprop_text->text_entry, "icon-release",
+ G_CALLBACK (glade_eprop_text_show_resource_dialog),
+ eprop);
}
}
if (glade_property_class_translatable (klass))
{
- GtkWidget *button = gtk_button_new_with_label ("\342\200\246");
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
- g_signal_connect (button, "clicked",
- G_CALLBACK (glade_eprop_text_show_i18n_dialog), eprop);
+ if (GTK_IS_ENTRY (eprop_text->text_entry))
+ {
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_text->text_entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_EDIT);
+ g_signal_connect_swapped (eprop_text->text_entry, "icon-release",
+ G_CALLBACK (glade_eprop_text_show_i18n_dialog),
+ eprop);
+ }
+ else
+ {
+ GtkWidget *button = gtk_button_new ();
+ gtk_button_set_image (GTK_BUTTON (button),
+ gtk_image_new_from_stock (GTK_STOCK_EDIT,
+ GTK_ICON_SIZE_MENU));
+ gtk_widget_show (button);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (glade_eprop_text_show_i18n_dialog),
+ eprop);
+ }
}
return hbox;
}
@@ -2870,8 +2864,7 @@ glade_editor_property_show_object_dialog (GladeProject *project,
static void
-glade_eprop_object_show_dialog (GtkWidget *dialog_button,
- GladeEditorProperty *eprop)
+glade_eprop_object_show_dialog (GladeEditorProperty *eprop)
{
GtkWidget *dialog, *parent;
GtkWidget *vbox, *label, *sw;
@@ -3126,24 +3119,17 @@ static GtkWidget *
glade_eprop_object_create_input (GladeEditorProperty *eprop)
{
GladeEPropObject *eprop_object = GLADE_EPROP_OBJECT (eprop);
- GtkWidget *hbox;
- GtkWidget *button;
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER);
eprop_object->entry = gtk_entry_new ();
+ gtk_widget_set_valign (eprop_object->entry, GTK_ALIGN_CENTER);
gtk_editable_set_editable (GTK_EDITABLE (eprop_object->entry), FALSE);
- gtk_widget_show (eprop_object->entry);
- gtk_box_pack_start (GTK_BOX (hbox), eprop_object->entry, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("...");
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (glade_eprop_object_show_dialog), eprop);
- return hbox;
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_object->entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_EDIT);
+ g_signal_connect_swapped (eprop_object->entry, "icon-release",
+ G_CALLBACK (glade_eprop_object_show_dialog), eprop);
+
+ return eprop_object->entry;
}
@@ -3218,8 +3204,7 @@ glade_eprop_objects_selected_widget (GtkTreeModel *model,
}
static void
-glade_eprop_objects_show_dialog (GtkWidget *dialog_button,
- GladeEditorProperty *eprop)
+glade_eprop_objects_show_dialog (GladeEditorProperty *eprop)
{
GtkWidget *dialog, *parent;
GtkWidget *vbox, *label, *sw;
@@ -3332,24 +3317,17 @@ static GtkWidget *
glade_eprop_objects_create_input (GladeEditorProperty *eprop)
{
GladeEPropObjects *eprop_objects = GLADE_EPROP_OBJECTS (eprop);
- GtkWidget *hbox;
- GtkWidget *button;
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_widget_set_valign (hbox, GTK_ALIGN_CENTER);
eprop_objects->entry = gtk_entry_new ();
+ gtk_widget_set_valign (eprop_objects->entry, GTK_ALIGN_CENTER);
gtk_editable_set_editable (GTK_EDITABLE (eprop_objects->entry), FALSE);
- gtk_widget_show (eprop_objects->entry);
- gtk_box_pack_start (GTK_BOX (hbox), eprop_objects->entry, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("...");
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (glade_eprop_objects_show_dialog), eprop);
- return hbox;
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_objects->entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_EDIT);
+ g_signal_connect_swapped (eprop_objects->entry, "icon-release",
+ G_CALLBACK (glade_eprop_objects_show_dialog), eprop);
+
+ return eprop_objects->entry;
}
/*******************************************************************************
diff --git a/plugins/gtk+/glade-accels.c b/plugins/gtk+/glade-accels.c
index e011b0a..31f9829 100644
--- a/plugins/gtk+/glade-accels.c
+++ b/plugins/gtk+/glade-accels.c
@@ -501,8 +501,7 @@ glade_eprop_accel_accum_accelerators (GtkTreeModel * model,
static void
-glade_eprop_accel_show_dialog (GtkWidget * dialog_button,
- GladeEditorProperty * eprop)
+glade_eprop_accel_show_dialog (GladeEditorProperty *eprop)
{
GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop);
GtkWidget *dialog, *parent, *vbox, *sw, *tree_view;
@@ -590,23 +589,17 @@ static GtkWidget *
glade_eprop_accel_create_input (GladeEditorProperty * eprop)
{
GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop);
- GtkWidget *hbox;
- GtkWidget *button;
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
eprop_accel->entry = gtk_entry_new ();
+ gtk_widget_set_valign (eprop_accel->entry, GTK_ALIGN_CENTER);
gtk_editable_set_editable (GTK_EDITABLE (eprop_accel->entry), FALSE);
- gtk_widget_show (eprop_accel->entry);
- gtk_box_pack_start (GTK_BOX (hbox), eprop_accel->entry, TRUE, TRUE, 0);
+ gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_accel->entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ GTK_STOCK_EDIT);
+ g_signal_connect_swapped (eprop_accel->entry, "icon-release",
+ G_CALLBACK (glade_eprop_accel_show_dialog), eprop);
- button = gtk_button_new_with_label ("...");
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (glade_eprop_accel_show_dialog), eprop);
-
- return hbox;
+ return eprop_accel->entry;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]