[maemo-commits] [maemo-commits] r11528 - in projects/haf/trunk/hildon-home-webshortcut: . plugin

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed May 9 10:01:21 EEST 2007
Author: jobi
Date: 2007-05-09 10:01:17 +0300 (Wed, 09 May 2007)
New Revision: 11528

Modified:
   projects/haf/trunk/hildon-home-webshortcut/ChangeLog
   projects/haf/trunk/hildon-home-webshortcut/configure.ac
   projects/haf/trunk/hildon-home-webshortcut/plugin/hildon-home-webshortcut.c
Log:

2007-05-09  Johan Bilien  <johan.bilien at nokia.com>

	* plugin/hildon-home-webshortcut.c: Only launch the URI when
	the user didn't drag the mouse.



Modified: projects/haf/trunk/hildon-home-webshortcut/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-home-webshortcut/ChangeLog	2007-05-08 22:48:04 UTC (rev 11527)
+++ projects/haf/trunk/hildon-home-webshortcut/ChangeLog	2007-05-09 07:01:17 UTC (rev 11528)
@@ -1,3 +1,8 @@
+2007-05-09  Johan Bilien  <johan.bilien at nokia.com>
+
+	* plugin/hildon-home-webshortcut.c: Only launch the URI when
+	the user didn't drag the mouse.
+
 2007-04-27  Johan Bilien  <johan.bilien at nokia.com>
 
 	* plugin/hildon-home-webshortcut.c: Pass the object

Modified: projects/haf/trunk/hildon-home-webshortcut/configure.ac
===================================================================
--- projects/haf/trunk/hildon-home-webshortcut/configure.ac	2007-05-08 22:48:04 UTC (rev 11527)
+++ projects/haf/trunk/hildon-home-webshortcut/configure.ac	2007-05-09 07:01:17 UTC (rev 11528)
@@ -25,7 +25,7 @@
 
 
 
-CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wmissing-prototypes -Wmissing-declarations -Werror" 
+CFLAGS="$CFLAGS -Wall -ansi  -Wmissing-prototypes -Wmissing-declarations -Werror" 
 
 AC_SUBST(CFLAGS)
 

Modified: projects/haf/trunk/hildon-home-webshortcut/plugin/hildon-home-webshortcut.c
===================================================================
--- projects/haf/trunk/hildon-home-webshortcut/plugin/hildon-home-webshortcut.c	2007-05-08 22:48:04 UTC (rev 11527)
+++ projects/haf/trunk/hildon-home-webshortcut/plugin/hildon-home-webshortcut.c	2007-05-09 07:01:17 UTC (rev 11528)
@@ -97,6 +97,7 @@
   guint             old_width;
   guint             old_height;
   GConfClient      *gconf_client;
+  gdouble           click_x, click_y;
 };
 
 HD_DEFINE_PLUGIN_WITH_CODE (Hhws, hhws, HILDON_DESKTOP_TYPE_HOME_ITEM, hhws_loader_register_type (module);)
@@ -184,7 +185,7 @@
 
   if (text)
     hhws_show_information_note (hhws, text);
-  
+
 }
 
 static void
@@ -501,43 +502,43 @@
     }
 }
 
+static gboolean
+hhws_button_press (GtkWidget           *widget,
+                   GdkEventButton      *event)
+{
+  Hhws             *hhws = HHWS (widget);
+  HhwsPrivate      *priv = hhws->priv;
 
+  priv->click_x = event->x_root;
+  priv->click_y = event->y_root;
+
+  return GTK_WIDGET_CLASS (hhws_parent_class)->button_press_event (widget,
+                                                                   event);
+}
+
 static gboolean
 hhws_button_release (GtkWidget         *widget,
                      GdkEventButton    *event)
 {
   Hhws             *hhws = HHWS (widget);
   HhwsPrivate      *priv = hhws->priv;
-  gint              applet_x, applet_y;
 
-  /* Get the widget's root coordinates */
-  gdk_window_get_origin (widget->window, &applet_x, &applet_y);
-  if (GTK_WIDGET_NO_WINDOW (widget))
+  if (priv->click_x != event->x_root || priv->click_y != event->y_root)
     {
-      applet_x += widget->allocation.x;
-      applet_y += widget->allocation.y;
-    }
-
-  if((gint)event->x_root < applet_x || 
-     (gint)event->x_root > applet_x + widget->allocation.width ||
-     (gint)event->y_root < applet_y ||
-     (gint)event->y_root > applet_y + widget->allocation.height)
-    {
-      /* Released outside the applet */
       return GTK_WIDGET_CLASS (hhws_parent_class)->button_release_event (widget,
                                                                          event);
     }
 
-  if (priv->iap) 
+  if (priv->iap)
     {
       if (osso_iap_connect (priv->iap,
                             OSSO_IAP_REQUESTED_CONNECT,
                             NULL) != OSSO_OK)
         g_critical ("osso_iap_connect != OSSO_OK");
-    } 
-  else
-    hhws_launch_uri (hhws);
+    }
 
+  hhws_launch_uri (hhws);
+
   return GTK_WIDGET_CLASS (hhws_parent_class)->button_release_event (widget,
                                                                      event);
 }
@@ -768,6 +769,7 @@
 
   applet_class->settings = hhws_settings;
 
+  widget_class->button_press_event   = hhws_button_press;
   widget_class->button_release_event = hhws_button_release;
 
   object_class->destroy = hhws_destroy;


More information about the maemo-commits mailing list