gtk+ r21941 - in trunk: . gtk tests
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r21941 - in trunk: . gtk tests
- Date: Sat, 27 Dec 2008 04:00:53 +0000 (UTC)
Author: matthiasc
Date: Sat Dec 27 04:00:52 2008
New Revision: 21941
URL: http://svn.gnome.org/viewvc/gtk+?rev=21941&view=rev
Log:
2008-12-26 Matthias Clasen <mclasen redhat com>
* gtk/gtkentry.c: Fix interaction between icons and widget sensitivity.
Also fix a few typos.
* tests/testentryicons.c: Add property editors.
* tests/Makefile.am: Glue
Modified:
trunk/ChangeLog
trunk/gtk/gtkentry.c
trunk/tests/Makefile.am
trunk/tests/testentryicons.c
Modified: trunk/gtk/gtkentry.c
==============================================================================
--- trunk/gtk/gtkentry.c (original)
+++ trunk/gtk/gtkentry.c Sat Dec 27 04:00:52 2008
@@ -1045,7 +1045,7 @@
g_object_class_install_property (gobject_class,
PROP_SENSITIVE_PRIMARY,
g_param_spec_boolean ("sensitive-primary",
- P_("Primary icon sensitvitiy"),
+ P_("Primary icon sensitive"),
P_("Whether the primary icon is sensitive"),
TRUE,
GTK_PARAM_READWRITE));
@@ -1063,7 +1063,7 @@
g_object_class_install_property (gobject_class,
PROP_SENSITIVE_SECONDARY,
g_param_spec_boolean ("sensitive-secondary",
- P_("Secondary icon sensitivity"),
+ P_("Secondary icon sensitive"),
P_("Whether the secondary icon is sensitive"),
TRUE,
GTK_PARAM_READWRITE));
@@ -2124,8 +2124,9 @@
if (icon_info->pixbuf != NULL)
gdk_window_show (icon_info->window);
- if (icon_info->insensitive ||
- (icon_info->nonactivatable && icon_info->target_list == NULL))
+ if (GTK_WIDGET_IS_SENSITIVE (widget) &&
+ (icon_info->insensitive ||
+ (icon_info->nonactivatable && icon_info->target_list == NULL)))
{
display = gtk_widget_get_display (widget);
cursor = gdk_cursor_new_for_display (display, GDK_XTERM);
@@ -2756,7 +2757,8 @@
x = (width - gdk_pixbuf_get_width (pixbuf)) / 2;
y = (height - gdk_pixbuf_get_height (pixbuf)) / 2;
- if (icon_info->insensitive)
+ if (!GTK_WIDGET_IS_SENSITIVE (widget) ||
+ icon_info->insensitive)
{
GdkPixbuf *temp_pixbuf;
@@ -3720,6 +3722,8 @@
gdk_cursor_unref (cursor);
entry->mouse_cursor_obscured = FALSE;
+
+ update_cursors (widget);
}
if (!GTK_WIDGET_IS_SENSITIVE (widget))
Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am (original)
+++ trunk/tests/Makefile.am Sat Dec 27 04:00:52 2008
@@ -229,6 +229,7 @@
testentrycompletion.c
testentryicons_SOURCES = \
+ prop-editor.c \
testentryicons.c
testfilechooser_SOURCES = \
Modified: trunk/tests/testentryicons.c
==============================================================================
--- trunk/tests/testentryicons.c (original)
+++ trunk/tests/testentryicons.c Sat Dec 27 04:00:52 2008
@@ -1,5 +1,45 @@
#include <gtk/gtk.h>
#include <stdio.h>
+#include "prop-editor.h"
+
+static void
+clear_pressed (GtkEntry *entry, gint icon, GdkEvent *event, gpointer data)
+{
+ if (icon == GTK_ENTRY_ICON_SECONDARY)
+ gtk_entry_set_text (entry, "");
+}
+
+static gboolean
+delete_event_cb (GtkWidget *editor,
+ gint response,
+ gpointer user_data)
+{
+ gtk_widget_hide (editor);
+
+ return TRUE;
+}
+
+static void
+properties_cb (GtkWidget *button,
+ GObject *entry)
+{
+ GtkWidget *editor;
+
+ editor = g_object_get_data (entry, "properties-dialog");
+
+ if (editor == NULL)
+ {
+ editor = create_prop_editor (G_OBJECT (entry), G_TYPE_INVALID);
+ gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
+ gtk_window_set_transient_for (GTK_WINDOW (editor),
+ GTK_WINDOW (gtk_widget_get_toplevel (button)));
+ g_signal_connect (editor, "delete-event", G_CALLBACK (delete_event_cb), NULL);
+ g_object_set_data (entry, "properties-dialog", editor);
+ }
+
+ gtk_window_present (GTK_WINDOW (editor));
+}
+
int
main (int argc, char **argv)
@@ -8,6 +48,7 @@
GtkWidget *table;
GtkWidget *label;
GtkWidget *entry;
+ GtkWidget *button;
GIcon *icon;
gtk_init (&argc, &argv);
@@ -36,7 +77,9 @@
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
- icon = g_themed_icon_new_with_default_fallbacks ("folder");
+ icon = g_themed_icon_new ("folder");
+ g_themed_icon_append_name (G_THEMED_ICON (icon), "gtk-directory");
+
gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
icon);
@@ -48,6 +91,13 @@
GTK_ENTRY_ICON_PRIMARY,
"Open a file");
+ button = gtk_button_new_with_label ("Properties");
+ gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
+ GTK_FILL, GTK_FILL, 0, 0);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (properties_cb), entry);
+
+
/*
* Save File - sets the icon using a stock id.
*/
@@ -61,7 +111,7 @@
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_entry_set_text (GTK_ENTRY (entry), "âRight-to-left");
gtk_widget_set_direction (entry, GTK_TEXT_DIR_RTL);
-
+
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_SAVE);
@@ -69,6 +119,12 @@
GTK_ENTRY_ICON_PRIMARY,
"Save a file");
+ button = gtk_button_new_with_label ("Properties");
+ gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
+ GTK_FILL, GTK_FILL, 0, 0);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (properties_cb), entry);
+
/*
* Search - Uses a helper function
*/
@@ -88,6 +144,17 @@
gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
GTK_ENTRY_ICON_SECONDARY,
GTK_STOCK_CLEAR);
+ gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
+ GTK_ENTRY_ICON_SECONDARY,
+ FALSE);
+
+ g_signal_connect (entry, "icon-pressed", G_CALLBACK (clear_pressed), NULL);
+
+ button = gtk_button_new_with_label ("Properties");
+ gtk_table_attach (GTK_TABLE (table), button, 2, 3, 2, 3,
+ GTK_FILL, GTK_FILL, 0, 0);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (properties_cb), entry);
/*
* Password - Sets the icon using a stock id
@@ -106,6 +173,12 @@
GTK_ENTRY_ICON_PRIMARY,
GTK_STOCK_DIALOG_AUTHENTICATION);
+ button = gtk_button_new_with_label ("Properties");
+ gtk_table_attach (GTK_TABLE (table), button, 2, 3, 3, 4,
+ GTK_FILL, GTK_FILL, 0, 0);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (properties_cb), entry);
+
/* Name - Does not set any icons. */
label = gtk_label_new ("Name:");
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
@@ -116,6 +189,12 @@
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 4, 5,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
+ button = gtk_button_new_with_label ("Properties");
+ gtk_table_attach (GTK_TABLE (table), button, 2, 3, 4, 5,
+ GTK_FILL, GTK_FILL, 0, 0);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (properties_cb), entry);
+
gtk_widget_show_all (window);
gtk_main();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]