GTK_ICON_ENTRY_SECONDARY, GTK_STOCK_CLEAR);
gtk_icon_entry_set_icon_highlight(GTK_ICON_ENTRY (cmdata->filter_entry),
GTK_ICON_ENTRY_SECONDARY, TRUE);
- g_signal_connect(cmdata->filter_entry, "icon_released",
+ g_signal_connect(cmdata->filter_entry, "icon-release",
G_CALLBACK(cm_filter_entry_clear_icon_released_cb), NULL);
g_signal_connect(cmdata->filter_entry, "changed", G_CALLBACK(cm_filter_entry_changed_cb), cmdata);
g_signal_connect(cmdata->filter_entry, "activate", G_CALLBACK(cm_filter_entry_changed_cb), cmdata);
#include "gtkiconentry.h"
+#if GTK_CHECK_VERSION (2, 16, 0)
+
+void
+gtk_icon_entry_set_icon_from_pixbuf (GtkEntry* entry,
+ GtkEntryIconPosition position,
+ GdkPixbuf* pixbuf)
+{
+ /* Without this ugly hack pixbuf icons don't work */
+ if (pixbuf)
+ {
+ gtk_widget_hide (GTK_WIDGET (entry));
+ gtk_entry_set_icon_from_pixbuf (entry, position, pixbuf);
+ gtk_widget_show (GTK_WIDGET (entry));
+ }
+}
+
+#else
+
#include <string.h>
#if GTK_CHECK_VERSION (2, 14, 0)
GdkCursorType cursor_type;
gboolean custom_cursor;
GtkImageType storage_type;
- #if GLIB_CHECK_VERSION (2, 16, 0)
GIcon *gicon;
- #endif
gchar *icon_name;
gboolean insensitive;
} EntryIconInfo;
G_TYPE_INT);
/**
- * GtkIconEntry::icon-released:
+ * GtkIconEntry::icon-release:
* @entry: The entry on which the signal is emitted.
* @icon_pos: The position of the clicked icon.
* @button: The mouse button clicked.
*
- * The ::icon-released signal is emitted on the button release from a
+ * The ::icon-release signal is emitted on the button release from a
* mouse click.
*/
- if (!(signals[ICON_RELEASED] = g_signal_lookup ("icon-released", GTK_TYPE_ENTRY)))
+ if (!(signals[ICON_RELEASED] = g_signal_lookup ("icon-release", GTK_TYPE_ENTRY)))
signals[ICON_RELEASED] =
- g_signal_new ("icon-released",
+ g_signal_new ("icon-release",
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkIconEntryClass, icon_released),
NULL,
GTK_PARAM_WRITABLE));
- #if GLIB_CHECK_VERSION (2, 16, 0)
g_object_class_install_property (gobject_class,
PROP_GICON_PRIMARY,
g_param_spec_object ("gicon-primary",
P_("GIcon for secondary icon"),
G_TYPE_ICON,
GTK_PARAM_READWRITE));
- #endif
g_type_class_add_private (klass, sizeof (GtkIconEntryPrivate));
}
g_value_get_string (value));
break;
- #if GLIB_CHECK_VERSION (2, 16, 0)
case PROP_GICON_PRIMARY:
gtk_icon_entry_set_icon_from_gicon (entry,
GTK_ICON_ENTRY_PRIMARY,
GTK_ICON_ENTRY_SECONDARY,
g_value_get_object (value));
break;
- #endif
}
}
GTK_ICON_ENTRY_SECONDARY));
break;
- #if GLIB_CHECK_VERSION (2, 16, 0)
case PROP_GICON_PRIMARY:
g_value_set_object (value,
gtk_icon_entry_get_gicon (entry,
g_value_set_object (value,
gtk_icon_entry_get_gicon (entry,
GTK_ICON_ENTRY_SECONDARY));
- #endif
}
}
* instead. If the current icon theme is changed, the icon will be updated
* appropriately.
*/
-
-#if GLIB_CHECK_VERSION (2, 16, 0)
void
gtk_icon_entry_set_icon_from_gicon (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
icon_pos,
pixbuf);
}
-#endif
/**
* gtk_icon_entry_set_cursor
*
* Returns: A #GIcon, or NULL if no icon is set or if the icon is not a GIcon.
*/
-
-
-#if GLIB_CHECK_VERSION (2, 16, 0)
GIcon *
gtk_icon_entry_get_gicon (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos)
return icon_info->storage_type == _GTK_IMAGE_GICON ? icon_info->gicon : NULL;
}
-#endif
/**
* gtk_icon_entry_get_icon_highlight
gdk_cursor_unref (cursor);
}
}
+
+#endif
#include <config.h>
#endif
-#include <glib.h>
-#if GLIB_CHECK_VERSION (2, 16, 0)
#include <gio/gio.h>
-#endif
#include <gtk/gtk.h>
G_BEGIN_DECLS
+#if GTK_CHECK_VERSION (2, 16, 0)
+ #define GtkIconEntry GtkEntry
+ #define GtkIconEntryPosition GtkEntryIconPosition
+ #define GTK_ICON_ENTRY_PRIMARY GTK_ENTRY_ICON_PRIMARY
+ #define GTK_ICON_ENTRY_SECONDARY GTK_ENTRY_ICON_SECONDARY
+ #define GTK_ICON_ENTRY GTK_ENTRY
+ #define GTK_TYPE_ICON_ENTRY GTK_TYPE_ENTRY
+ #define gtk_icon_entry_new gtk_entry_new
+ #define gtk_icon_entry_set_icon_from_stock gtk_entry_set_icon_from_stock
+ void
+ gtk_icon_entry_set_icon_from_pixbuf (GtkEntry* entry,
+ GtkEntryIconPosition position,
+ GdkPixbuf* pixbuf);
+ #define gtk_icon_entry_set_icon_highlight gtk_entry_set_icon_activatable
+#else
+
#define GTK_TYPE_ICON_ENTRY (gtk_icon_entry_get_type())
#define GTK_ICON_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_ICON_ENTRY, GtkIconEntry))
#define GTK_ICON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_ICON_ENTRY, GtkIconEntryClass))
GtkIconEntryPosition icon_pos,
const gchar *icon_name);
-#if GLIB_CHECK_VERSION (2, 16, 0)
void gtk_icon_entry_set_icon_from_gicon (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
GIcon *icon);
-#endif
+
GdkPixbuf* gtk_icon_entry_get_pixbuf (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos);
-#if GLIB_CHECK_VERSION (2, 16, 0)
+
GIcon* gtk_icon_entry_get_gicon (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos);
-#endif
void gtk_icon_entry_set_icon_highlight (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
GtkIconEntryPosition icon_pos,
gboolean sensitive);
+#endif
+
G_END_DECLS
#endif /* __GTK_ICON_ENTRY_H__ */
GTK_STOCK_CLEAR);
gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (browser->find_text),
GTK_ICON_ENTRY_SECONDARY, TRUE);
- g_signal_connect (browser->find_text, "icon_released",
+ g_signal_connect (browser->find_text, "icon-release",
G_CALLBACK (midori_browser_entry_clear_icon_released_cb), NULL);
g_signal_connect (browser->find_text, "activate",
G_CALLBACK (_action_find_next_activate), browser);
midori_location_action_key_press_event_cb, action,
"signal::focus-out-event",
midori_location_action_focus_out_event_cb, action,
- "signal::icon-released",
+ "signal::icon-release",
midori_location_action_icon_released_cb, action,
NULL);
}
}
-#define HAVE_ENTRY_PROGRESS 1
-
-#ifdef HAVE_ENTRY_PROGRESS
+#if !GTK_CHECK_VERSION (2, 16, 0)
/* GTK+/ GtkEntry internal helper function
Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
gdk_drawable_get_size (text_area, &width, &height);
- if (location_entry->progress > 0.0/* && location_entry->progress < 1.0*/)
+ if (location_entry->progress > 0.0)
{
gtk_paint_box (entry->style, text_area,
GTK_STATE_SELECTED, GTK_SHADOW_OUT,
midori_location_entry_set_progress (MidoriLocationEntry* location_entry,
gdouble progress)
{
- #ifdef HAVE_ENTRY_PROGRESS
GtkWidget* child;
- #endif
g_return_if_fail (MIDORI_IS_LOCATION_ENTRY (location_entry));
location_entry->progress = CLAMP (progress, 0.0, 1.0);
- #ifdef HAVE_ENTRY_PROGRESS
child = gtk_bin_get_child (GTK_BIN (location_entry));
+ #if !GTK_CHECK_VERSION (2, 16, 0)
if (GTK_ENTRY (child)->text_area)
gdk_window_invalidate_rect (GTK_ENTRY (child)->text_area, NULL, FALSE);
+ #else
+ gtk_entry_set_progress_fraction (GTK_ENTRY (child), progress);
#endif
}
GTK_ICON_ENTRY_SECONDARY, TRUE);
g_signal_connect_after (entry, "key-press-event",
G_CALLBACK (entry_key_press_event), location_entry);
- #ifdef HAVE_ENTRY_PROGRESS
+ #if !GTK_CHECK_VERSION (2, 16, 0)
g_signal_connect_after (entry, "expose-event",
G_CALLBACK (entry_expose_event), location_entry);
#endif
midori_search_action_key_press_event_cb, action,
"signal::focus-out-event",
midori_search_action_focus_out_event_cb, action,
- "signal::icon-released",
+ "signal::icon-release",
midori_search_action_icon_released_cb, action,
"signal::scroll-event",
midori_search_action_scroll_event_cb, action,