glade3 r1994 - trunk/plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1994 - trunk/plugins/gtk+
- Date: Fri, 24 Oct 2008 18:51:54 +0000 (UTC)
Author: tvb
Date: Fri Oct 24 18:51:54 2008
New Revision: 1994
URL: http://svn.gnome.org/viewvc/glade3?rev=1994&view=rev
Log:
fixing modifications of icon sources (the string_from_value wasnt good)x
Modified:
trunk/plugins/gtk+/glade-gtk.c
trunk/plugins/gtk+/glade-icon-sources.c
Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c (original)
+++ trunk/plugins/gtk+/glade-gtk.c Fri Oct 24 18:51:54 2008
@@ -9450,7 +9450,7 @@
if (!gtk_icon_source_get_state_wildcarded (source))
{
- GtkStateType state = gtk_icon_source_get_size (source);
+ GtkStateType state = gtk_icon_source_get_state (source);
str = glade_utils_enum_string_from_value (GTK_TYPE_STATE_TYPE, state);
g_string_append_printf (string, "state-%s ", str);
g_free (str);
@@ -9476,6 +9476,7 @@
string = g_string_new ("");
g_hash_table_foreach (sources->sources, (GHFunc)serialize_icon_sources, string);
+
return g_string_free (string, FALSE);
}
else
Modified: trunk/plugins/gtk+/glade-icon-sources.c
==============================================================================
--- trunk/plugins/gtk+/glade-icon-sources.c (original)
+++ trunk/plugins/gtk+/glade-icon-sources.c Fri Oct 24 18:51:54 2008
@@ -603,7 +603,6 @@
gtk_tree_model_get (GTK_TREE_MODEL (eprop_sources->store), &iter,
COLUMN_ICON_NAME, &icon_name,
COLUMN_LIST_INDEX, &index,
- edit_column, &edit_column_active,
-1);
glade_property_get (eprop->property, &icon_sources);
@@ -651,6 +650,102 @@
return;
}
+static gboolean
+icon_sources_query_tooltip (GtkWidget *widget,
+ gint x,
+ gint y,
+ gboolean keyboard_mode,
+ GtkTooltip *tooltip,
+ GladeEPropIconSources *eprop_sources)
+{
+ GtkTreePath *path = NULL;
+ GtkTreeIter iter;
+ GtkTreeViewColumn *column = NULL;
+ gint bin_x = x, bin_y = y, col;
+ gchar *icon_name = NULL;
+ gboolean show_now = FALSE;
+
+ if (keyboard_mode)
+ return FALSE;
+
+ gtk_tree_view_convert_widget_to_bin_window_coords (eprop_sources->view,
+ x, y, &bin_x, &bin_y);
+
+ if (gtk_tree_view_get_path_at_pos (eprop_sources->view,
+ bin_x, bin_y,
+ &path, &column, NULL, NULL))
+ {
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (eprop_sources->store), &iter, path))
+ {
+ col = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (column), "column-id"));
+
+ gtk_tree_model_get (GTK_TREE_MODEL (eprop_sources->store), &iter,
+ COLUMN_ICON_NAME, &icon_name, -1);
+
+ /* no tooltips on the parent rows */
+ if (icon_name)
+ {
+ gchar *tooltip_text = NULL;
+ show_now = TRUE;
+
+ switch (col)
+ {
+ case COLUMN_TEXT:
+ tooltip_text =
+ g_strdup_printf (_("Enter a filename or a relative or full path for this "
+ "source of '%s' (Glade will only ever load them in"
+ "the runtime from your project directory)."),
+ icon_name);
+ break;
+ case COLUMN_DIRECTION_ACTIVE:
+ tooltip_text =
+ g_strdup_printf (_("Set whether you want to specify a text direction "
+ "for this source of '%s'"), icon_name);
+ break;
+ case COLUMN_DIRECTION:
+ tooltip_text =
+ g_strdup_printf (_("Set the text direction for this source of '%s'"),
+ icon_name);
+ break;
+ case COLUMN_SIZE_ACTIVE:
+ tooltip_text =
+ g_strdup_printf (_("Set whether you want to specify an icon size "
+ "for this source of '%s'"), icon_name);
+ break;
+ case COLUMN_SIZE:
+ tooltip_text =
+ g_strdup_printf (_("Set the icon size for this source of '%s'"),
+ icon_name);
+ break;
+ case COLUMN_STATE_ACTIVE:
+ tooltip_text =
+ g_strdup_printf (_("Set whether you want to specify a state "
+ "for this source of '%s'"), icon_name);
+ break;
+ case COLUMN_STATE:
+ tooltip_text =
+ g_strdup_printf (_("Set the state for this source of '%s'"),
+ icon_name);
+ default:
+ break;
+
+ }
+
+ gtk_tooltip_set_text (tooltip, tooltip_text);
+ g_free (tooltip_text);
+ g_free (icon_name);
+
+
+ gtk_tree_view_set_tooltip_cell (eprop_sources->view,
+ tooltip, path, column, NULL);
+
+ }
+ }
+ gtk_tree_path_free (path);
+ }
+ return show_now;
+}
+
static GtkTreeView *
build_view (GladeEditorProperty *eprop)
{
@@ -682,6 +777,9 @@
gtk_tree_view_column_set_expand (eprop_sources->filename_column, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), eprop_sources->filename_column);
+ g_object_set_data (G_OBJECT (eprop_sources->filename_column), "column-id",
+ GINT_TO_POINTER (COLUMN_TEXT));
+
/********************* Direction *********************/
/* Attribute active portion */
renderer = gtk_cell_renderer_toggle_new ();
@@ -697,6 +795,9 @@
"active", COLUMN_DIRECTION_ACTIVE,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ g_object_set_data (G_OBJECT (column), "column-id",
+ GINT_TO_POINTER (COLUMN_DIRECTION_ACTIVE));
+
/* Attribute portion */
renderer = gtk_cell_renderer_combo_new ();
@@ -714,6 +815,9 @@
"text", COLUMN_DIRECTION,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ g_object_set_data (G_OBJECT (column), "column-id",
+ GINT_TO_POINTER (COLUMN_DIRECTION));
+
/********************* Size *********************/
/* Attribute active portion */
@@ -730,6 +834,8 @@
"active", COLUMN_SIZE_ACTIVE,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ g_object_set_data (G_OBJECT (column), "column-id",
+ GINT_TO_POINTER (COLUMN_SIZE_ACTIVE));
/* Attribute portion */
renderer = gtk_cell_renderer_combo_new ();
@@ -747,6 +853,8 @@
"text", COLUMN_SIZE,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ g_object_set_data (G_OBJECT (column), "column-id",
+ GINT_TO_POINTER (COLUMN_SIZE));
/********************* State *********************/
@@ -764,6 +872,8 @@
"active", COLUMN_STATE_ACTIVE,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ g_object_set_data (G_OBJECT (column), "column-id",
+ GINT_TO_POINTER (COLUMN_STATE_ACTIVE));
/* Attribute portion */
renderer = gtk_cell_renderer_combo_new ();
@@ -781,8 +891,14 @@
"text", COLUMN_STATE,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ g_object_set_data (G_OBJECT (column), "column-id",
+ GINT_TO_POINTER (COLUMN_STATE));
/* Connect ::query-tooltip here for fancy tooltips... */
+ g_object_set (G_OBJECT (view), "has-tooltip", TRUE, NULL);
+ g_signal_connect (G_OBJECT (view), "query-tooltip",
+ G_CALLBACK (icon_sources_query_tooltip), eprop);
+
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (view), FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]