Re: Control Center Shell



Denis Washington wrote:
Thomas Wood wrote:
Denis Washington wrote:
[...]
Nice, I like your work! Your right, coding is better than criticizing,
so I'll start working on the clear button right NOW. ;)

Another thing that certainly needs work is the context menu for the
control center entries. The "Add to Favorites" button is for instance
practically useless because we don't use the SLAB menu by default, maybe
it's availability could be a build or gconf option. Also the bold "Start
..." makes sense for Windows users, but is not common for GNOME. The
entries may also need some icons for a better appearance. I'll try to
work on all those things and submit some patches soon.
I have written and attached a patch that replaces the search watermark with a clean button. It introduces libsexy as an external dependency because I used SexyIconEntry for the implementation, maybe this dependency can be approved or avoided by putting libsexy directly into the source tree like done in Rhythmbox. To compile it, add "-lsexy" to LIBSLAB_LIBS in libslab/Makefile.
Wow, I didn't even realise there was a context menu. However, it does
seem perfectly useless as it stands at the moment. Do we really need it
at all?

I think the clear button is a nice idea. I still don't understand the
search entry watermark. My initial reaction was that it was a clear
button, or a drop down menu or something.

-Thomas


I guess the watermark is often used in SLED so a user of that distro is "trained" to recognize such an entry as search entry, so it has a re-recoginition effect there. In GNOME that's naturally not the case, so it is useless. By the way, maybe we could meet in IRC some time and hack a bit on the control center shell? That would be pretty nice I think :).

Denis
_______________________________________________
gnomecc-list mailing list
gnomecc-list gnome org
http://mail.gnome.org/mailman/listinfo/gnomecc-list


Index: libslab/search-entry.h
===================================================================
RCS file: /cvs/gnome/slab/libslab/search-entry.h,v
retrieving revision 1.2
diff -u -8 -p -r1.2 search-entry.h
--- libslab/search-entry.h	15 Sep 2006 23:02:11 -0000	1.2
+++ libslab/search-entry.h	19 Nov 2006 19:34:42 -0000
@@ -16,35 +16,35 @@
  * You should have received a copy of the GNU Lesser General Public License
  * along with libslab; if not, write to the Free Software Foundation, Inc., 51
  * Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifndef __NLD_SEARCH_ENTRY_H__
 #define __NLD_SEARCH_ENTRY_H__
 
-#include <gtk/gtkentry.h>
+#include <libsexy/sexy-icon-entry.h>
 
 G_BEGIN_DECLS
 
 #define NLD_TYPE_SEARCH_ENTRY            (nld_search_entry_get_type ())
 #define NLD_SEARCH_ENTRY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NLD_TYPE_SEARCH_ENTRY, NldSearchEntry))
 #define NLD_SEARCH_ENTRY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NLD_TYPE_SEARCH_ENTRY, NldSearchEntryClass))
 #define NLD_IS_SEARCH_ENTRY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NLD_TYPE_SEARCH_ENTRY))
 #define NLD_IS_SEARCH_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NLD_TYPE_SEARCH_ENTRY))
 #define NLD_SEARCH_ENTRY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NLD_TYPE_SEARCH_ENTRY, NldSearchEntryClass))
 
 typedef struct
 {
-	GtkEntry parent;
+	SexyIconEntry parent;
 } NldSearchEntry;
 
 typedef struct
 {
-	GtkEntryClass parent_class;
+	SexyIconEntryClass parent_class;
 } NldSearchEntryClass;
 
 GType nld_search_entry_get_type (void);
 
 GtkWidget *nld_search_entry_new (void);
 
 G_END_DECLS
 #endif /* __NLD_SEARCH_ENTRY_H__ */
Index: libslab/search-entry.c
===================================================================
RCS file: /cvs/gnome/slab/libslab/search-entry.c,v
retrieving revision 1.2
diff -u -8 -p -r1.2 search-entry.c
--- libslab/search-entry.c	15 Sep 2006 23:02:11 -0000	1.2
+++ libslab/search-entry.c	19 Nov 2006 19:34:42 -0000
@@ -14,132 +14,38 @@
  * more details.
  *
  * You should have received a copy of the GNU Lesser General Public License
  * along with libslab; if not, write to the Free Software Foundation, Inc., 51
  * Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "search-entry.h"
-#include "search-entry-watermark.h"
-
-#include <librsvg/rsvg.h>
-#include <string.h>
 
 typedef struct
 {
 	GdkPixbuf *watermark;
 	int width, height;
 } NldSearchEntryPrivate;
 
 #define NLD_SEARCH_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NLD_TYPE_SEARCH_ENTRY, NldSearchEntryPrivate))
 
 static void nld_search_entry_class_init (NldSearchEntryClass *);
-static void nld_search_entry_init (NldSearchEntry *);
-static void nld_search_entry_finalize (GObject *);
-
-static void nld_search_entry_realize (GtkWidget * widget);
-static gboolean nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event);
 
-G_DEFINE_TYPE (NldSearchEntry, nld_search_entry, GTK_TYPE_ENTRY)
+G_DEFINE_TYPE (NldSearchEntry, nld_search_entry, SEXY_TYPE_ICON_ENTRY)
 
 static void nld_search_entry_class_init (NldSearchEntryClass * nld_search_entry_class)
 {
 	GObjectClass *g_obj_class = G_OBJECT_CLASS (nld_search_entry_class);
 	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (nld_search_entry_class);
-
-	g_type_class_add_private (nld_search_entry_class, sizeof (NldSearchEntryPrivate));
-
-	widget_class->realize = nld_search_entry_realize;
-	widget_class->expose_event = nld_search_entry_expose_event;
-
-	g_obj_class->finalize = nld_search_entry_finalize;
 }
 
 static void
 nld_search_entry_init (NldSearchEntry * entry)
 {
-}
-
-static void
-nld_search_entry_finalize (GObject * object)
-{
-	NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (object);
-
-	if (priv->watermark)
-		g_object_unref (priv->watermark);
-
-	G_OBJECT_CLASS (nld_search_entry_parent_class)->finalize (object);
-}
-
-static void
-rsvg_size_callback (int *width, int *height, gpointer user_data)
-{
-	NldSearchEntryPrivate *priv = user_data;
-
-	*width = priv->width = priv->height * (double) *width / (double) *height;
-	*height = priv->height;
-}
-
-static void
-nld_search_entry_realize (GtkWidget * widget)
-{
-	NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (widget);
-	int height;
-	GdkColor *gdkcolor;
-	char *svg, color[7];
-	RsvgHandle *rsvg;
-
-	GTK_WIDGET_CLASS (nld_search_entry_parent_class)->realize (widget);
-
-	gdk_window_get_geometry (GTK_ENTRY (widget)->text_area, NULL, NULL, NULL, &height, NULL);
-
-	if (height - 2 == priv->height)
-		return;
-	priv->height = height - 2;
-
-	gdkcolor = &widget->style->fg[GTK_WIDGET_STATE (widget)];
-	snprintf (color, 6, "%02x%02x%02x", gdkcolor->red >> 8, gdkcolor->green >> 8,
-		gdkcolor->blue >> 8);
-	svg = g_strdup_printf (SEARCH_ENTRY_WATERMARK_SVG, color, color);
-
-	rsvg = rsvg_handle_new ();
-	rsvg_handle_set_size_callback (rsvg, rsvg_size_callback, priv, NULL);
-	rsvg_handle_write (rsvg, (const guchar *) svg, strlen (svg), NULL);
-	rsvg_handle_close (rsvg, NULL);
-	g_free (svg);
-
-	if (priv->watermark)
-		g_object_unref (priv->watermark);
-	priv->watermark = rsvg_handle_get_pixbuf (rsvg);
-	rsvg_handle_free (rsvg);
-}
-
-static gboolean
-nld_search_entry_expose_event (GtkWidget * widget, GdkEventExpose * event)
-{
-	NldSearchEntryPrivate *priv = NLD_SEARCH_ENTRY_GET_PRIVATE (widget);
-	GTK_WIDGET_CLASS (nld_search_entry_parent_class)->expose_event (widget, event);
-
-	if (event->window == GTK_ENTRY (widget)->text_area)
-	{
-		int width, height, x;
-
-		if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
-		{
-			gdk_drawable_get_size (event->window, &width, &height);
-			x = width - priv->width - 1;
-		}
-		else
-			x = 1;
-		gdk_draw_pixbuf (event->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
-			priv->watermark, 0, 0, x, 1, priv->width, priv->height,
-			GDK_RGB_DITHER_NORMAL, 0, 0);
-	}
-
-	return FALSE;
+	sexy_icon_entry_add_clear_button ((SexyIconEntry*) entry);
 }
 
 GtkWidget *
 nld_search_entry_new (void)
 {
 	return g_object_new (NLD_TYPE_SEARCH_ENTRY, NULL);
 }

PNG image



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