r1330 - trunk/src/target/OM-2007/openmoko-libs/libmokoui

thomas at sita.openmoko.org thomas at sita.openmoko.org
Mon Mar 12 18:35:47 CET 2007


Author: thomas
Date: 2007-03-12 18:35:45 +0100 (Mon, 12 Mar 2007)
New Revision: 1330

Modified:
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-wheel.c
   trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-window.c
Log:
* libmokoui/moko-finger-tool-box.c: Don't segfault if the theme hasn't specified a background image
* libmokoui/moko-finger-wheel.c: Don't segfault if the theme hasn't specified a background image
* libmokoui/moko-finger-window.c: Don't try and access windows that don't exist


Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c	2007-03-12 16:02:25 UTC (rev 1329)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-tool-box.c	2007-03-12 17:35:45 UTC (rev 1330)
@@ -187,7 +187,17 @@
     g_assert( style->rc_style );
 
     if ( !priv->background_pixbuf )
-        priv->background_pixbuf = gdk_pixbuf_new_from_file( style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL], NULL);
+    {
+        gchar *filename;
+        if (filename = style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL])
+            priv->background_pixbuf = gdk_pixbuf_new_from_file( style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL], NULL);
+        else
+        {
+            g_warning ("moko_finger_tool_box: theme does not specify a background image for the finger tool box");
+            return;
+        }
+
+    }
     GdkPixbuf* pixbuf = gdk_pixbuf_scale_simple( priv->background_pixbuf, a->width, a->height, GDK_INTERP_BILINEAR );
     
     if ( !priv->button_pixbuf )

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-wheel.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-wheel.c	2007-03-12 16:02:25 UTC (rev 1329)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-wheel.c	2007-03-12 17:35:45 UTC (rev 1330)
@@ -234,6 +234,12 @@
         gtk_window_move( GTK_WINDOW(priv->popup), geometry.x, geometry.y );
 
         //FIXME Isn't there a way to get this as a mask directly from the style without having to reload it?
+        gchar *background_filename = GTK_WIDGET(widget)->style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL];
+        if (!background_filename)
+        {
+            g_warning ("moko_finger_wheel: theme does not specify a background image for the finger wheel");
+            return;
+        }
         GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(GTK_WIDGET(widget)->style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL], NULL);
         GdkPixmap* pixmap;
         GdkBitmap* mask;

Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-window.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-window.c	2007-03-12 16:02:25 UTC (rev 1329)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-finger-window.c	2007-03-12 17:35:45 UTC (rev 1330)
@@ -130,11 +130,15 @@
     moko_debug( "moko_finger_window_geometry_hint" );
 
     GtkRequisition req;
-    gtk_widget_size_request( hintee, &req );
     int x, y, w, h;
-    gdk_window_get_geometry( GTK_WIDGET(self)->window, &x, &y, &w, &h, NULL );
     int absx;
     int absy;
+
+    if (!GTK_WIDGET(self)->window)
+        return;
+
+    gtk_widget_size_request( hintee, &req );
+    gdk_window_get_geometry( GTK_WIDGET(self)->window, &x, &y, &w, &h, NULL );
     gdk_window_get_origin( GTK_WIDGET(self)->window, &absx, &absy );
 
     moko_debug( "hintee requisition is %d, %d", req.width, req.height );





More information about the commitlog mailing list