[tasks] Use GTK+ icon entry support instead of libsexy



commit 267235bf334721370f58794047dfbb92340ea3e0
Author: Ross Burton <ross linux intel com>
Date:   Mon Jun 8 22:16:48 2009 +0100

    Use GTK+ icon entry support instead of libsexy
---
 configure.ac                        |   12 +++------
 libkoto/koto-field-editor-factory.c |   45 +++++++++++++---------------------
 src/gtk/Makefile.am                 |    2 -
 src/hildon/Makefile.am              |    2 +-
 src/omoko/Makefile.am               |    2 +-
 5 files changed, 23 insertions(+), 40 deletions(-)

diff --git a/configure.ac b/configure.ac
index cd9f3a5..179b91d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,14 +24,6 @@ PKG_CHECK_MODULES(ECAL, libecal-1.2)
 
 AC_DEFINE(HANDLE_LIBICAL_MEMORY, 1, [we free libical memory])
 
-# Check for libsexy 0.1.12. Older versions don't support icon-names in the
-# entries, so don't work.
-PKG_CHECK_MODULES(SEXY, libsexy >= 0.1.12, sexy=yes, sexy=no)
-if test $sexy = yes; then
-        AC_DEFINE(HAVE_SEXY, 1, [libsexy present])
-fi
-
-
 AC_ARG_ENABLE(gtk,
         AS_HELP_STRING([--enable-gtk],[Build the GTK frontend]),
         ,enable_gtk=yes)
@@ -106,6 +98,10 @@ AC_CHECK_DECLS([gtk_widget_set_has_tooltip],
 AC_CHECK_DECLS([gtk_show_uri],
                [], [], [#include <gtk/gtk.h>])
 
+# This was introduced in GTK+ 2.16
+AC_CHECK_DECLS([gtk_entry_set_icon_from_icon_name],
+               [], [], [#include <gtk/gtk.h>])
+
 # This was introduced in newer libecal
 CFLAGS=$ECAL_CFLAGS
 AC_CHECK_TYPES(ECalComponentId, [], [], [#include <libecal/e-cal.h>])
diff --git a/libkoto/koto-field-editor-factory.c b/libkoto/koto-field-editor-factory.c
index 9147d5d..bb776ab 100644
--- a/libkoto/koto-field-editor-factory.c
+++ b/libkoto/koto-field-editor-factory.c
@@ -22,10 +22,6 @@
 #include <gtk/gtk.h>
 #include <libical/ical.h>
 
-#ifdef HAVE_SEXY
-#include <libsexy/sexy-icon-entry.h>
-#endif
-
 #include "ical-util.h"
 #include "koto-task.h"
 #include "koto-group.h"
@@ -136,9 +132,11 @@ entry_set (GtkWidget *widget, icalproperty *prop)
  * URL entries.
  */
 
-#ifdef HAVE_SEXY
 static void
-url_entry_icon_clicked (SexyIconEntry *entry, gint icon_pos, gint button, gpointer user_data)
+url_entry_icon_clicked (GtkEntry *entry,
+		        GtkEntryIconPosition icon_pos,
+			GdkEvent *event,
+			gpointer user_data)
 {
   const char *text;
   text = gtk_entry_get_text (GTK_ENTRY (entry));
@@ -148,16 +146,17 @@ url_entry_icon_clicked (SexyIconEntry *entry, gint icon_pos, gint button, gpoint
   }
 }
 
+#if HAVE_DECL_GTK_ENTRY_SET_ICON_FROM_ICON_NAME
 static void
-on_icon_entry_changed (SexyIconEntry *entry)
+on_url_entry_changed (GtkEntry *entry)
 {
   const char *text;
 
   text = gtk_entry_get_text (GTK_ENTRY (entry));
 
-  sexy_icon_entry_set_icon_highlight (entry,
-                                      SEXY_ICON_ENTRY_SECONDARY,
-                                      text != NULL && text[0] != '\0');
+  gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
+                                  GTK_ENTRY_ICON_SECONDARY,
+                                  text != NULL && text[0] != '\0');
 }
 #endif
 
@@ -167,27 +166,21 @@ url_entry_new (void)
   GtkWidget *entry;
   guint id;
 
-#ifdef HAVE_SEXY
-  GtkWidget *image;
-
-  entry = sexy_icon_entry_new ();
-  image = gtk_image_new_from_icon_name ("stock_internet", GTK_ICON_SIZE_MENU);
-
-  sexy_icon_entry_set_icon (SEXY_ICON_ENTRY (entry),
-                            SEXY_ICON_ENTRY_SECONDARY, GTK_IMAGE (image));
-
-  g_signal_connect (entry, "icon-released", G_CALLBACK (url_entry_icon_clicked), NULL);
-#else
   entry = koto_entry_new ();
-#endif
 
   /* This changed callback updates the property */
   id = g_signal_connect (entry, "changed", G_CALLBACK (on_entry_changed), NULL);
   g_object_set_data (G_OBJECT (entry), SIGNAL_DATA, GINT_TO_POINTER (id));
 
-#ifdef HAVE_SEXY
+#if HAVE_DECL_GTK_ENTRY_SET_ICON_FROM_ICON_NAME
+  gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
+                                     GTK_ENTRY_ICON_SECONDARY, "stock_internet");
+  gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
+                                  GTK_ENTRY_ICON_SECONDARY,
+                                  FALSE);
+  g_signal_connect (entry, "icon-release", G_CALLBACK (url_entry_icon_clicked), NULL);
   /* This callback enables or disables the icon highlighting */
-  g_signal_connect (entry, "changed", G_CALLBACK (on_icon_entry_changed), NULL);
+  g_signal_connect (entry, "changed", G_CALLBACK (on_url_entry_changed), NULL);
 #endif
 
   return entry;
@@ -210,11 +203,7 @@ url_entry_set (GtkWidget *widget, icalproperty *prop)
   }
 
   g_signal_handler_block (widget, id);
-#ifdef HAVE_SEXY
-  gtk_entry_set_text (GTK_ENTRY (widget), text);
-#else
   koto_entry_set_text (KOTO_ENTRY (widget), text);
-#endif
   g_signal_handler_unblock (widget, id);
 }
 
diff --git a/src/gtk/Makefile.am b/src/gtk/Makefile.am
index 8fb325b..55c3ddc 100644
--- a/src/gtk/Makefile.am
+++ b/src/gtk/Makefile.am
@@ -7,14 +7,12 @@ tasks_CFLAGS = \
 	$(WARN_CFLAGS) \
 	$(GTK_CFLAGS) \
 	$(ECAL_CFLAGS) \
-	$(SEXY_CFLAGS) \
 	$(OWL_CFLAGS) \
 	$(UNIQUE_CFLAGS)
 tasks_LDADD = \
 	$(top_builddir)/libkoto/libkoto.a \
 	$(GTK_LIBS) \
 	$(ECAL_LIBS) \
-	$(SEXY_LIBS) \
 	$(OWL_LIBS) \
 	$(UNIQUE_LIBS)
 
diff --git a/src/hildon/Makefile.am b/src/hildon/Makefile.am
index 993c646..be2ef24 100644
--- a/src/hildon/Makefile.am
+++ b/src/hildon/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES = -DLOCALEDIR=\"$(localedir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
 bin_PROGRAMS = tasks
 tasks_CPPFLAGS = -I$(top_srcdir)/
 tasks_CFLAGS = $(WARN_CFLAGS) $(GTK_CFLAGS) $(ECAL_CFLAGS) $(HILDON_CFLAGS)
-tasks_LDADD = $(top_builddir)/libkoto/libkoto.a $(GTK_LIBS) $(ECAL_LIBS) $(HILDON_LIBS) $(SEXY_LIBS)
+tasks_LDADD = $(top_builddir)/libkoto/libkoto.a $(GTK_LIBS) $(ECAL_LIBS) $(HILDON_LIBS)
 
 tasks_SOURCES = \
 	hildon-tasks.c 
diff --git a/src/omoko/Makefile.am b/src/omoko/Makefile.am
index 5d61ab9..f1cab86 100644
--- a/src/omoko/Makefile.am
+++ b/src/omoko/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES = -DLOCALEDIR=\"$(localedir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
 bin_PROGRAMS = tasks
 tasks_CPPFLAGS = -I$(top_srcdir)/
 tasks_CFLAGS = $(WARN_CFLAGS) $(GTK_CFLAGS) $(ECAL_CFLAGS) $(OMOKO_CFLAGS)
-tasks_LDADD = $(top_builddir)/libkoto/libkoto.a $(GTK_LIBS) $(ECAL_LIBS) $(OMOKO_LIBS) $(SEXY_LIBS)
+tasks_LDADD = $(top_builddir)/libkoto/libkoto.a $(GTK_LIBS) $(ECAL_LIBS) $(OMOKO_LIBS)
 
 tasks_SOURCES = \
 	openmoko-tasks.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]