[maemo-commits] [maemo-commits] r10805 - in projects/haf/trunk/hildon-desktop: . libhildonwm src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Mar 28 14:34:05 EEST 2007
Author: moimart
Date: 2007-03-28 14:34:04 +0300 (Wed, 28 Mar 2007)
New Revision: 10805

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
   projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c
Log:

	* src/hn-app-switcher.c:
        - Handling of swap key fixed.
        - Open thumb menu when swap key pressed.
        * libhildonwm/hd-wm.c (working copy):
        - Created constructor and moved DBus initialization to constructor.



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-03-28 11:17:16 UTC (rev 10804)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-03-28 11:34:04 UTC (rev 10805)
@@ -1,3 +1,11 @@
+2007-03-28  Moises Martinez  <moises.martinez at nokia.com>
+
+	* src/hn-app-switcher.c: 
+	- Handling of swap key fixed.
+	- Open thumb menu when swap key pressed.
+	* libhildonwm/hd-wm.c (working copy):
+	- Created constructor and moved DBus initialization to constructor.
+
 2007-03-28  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* src/hd-home-background.c, src/hd-desktop.c,

Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-03-28 11:17:16 UTC (rev 10804)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c	2007-03-28 11:34:04 UTC (rev 10805)
@@ -162,6 +162,13 @@
 hd_wm_relaunch_timeout (gpointer data);
 
 static void 
+hd_wm_register_object_path (HDWM *hdwm,
+ 			    DBusConnection *conn,
+			    DBusObjectPathMessageFunction func,
+			    gchar *interface,
+			    gchar *path);
+
+static void 
 hd_wm_check_net_state (HDWM *hdwm, HDWMWatchedWindow *win);
 
 static void hd_wm_get_property (GObject *object,
@@ -760,6 +767,8 @@
   if (strcmp (HOME_LONG_PRESS, member) == 0 && !hd_wm_modal_windows_present())
   {
     g_signal_emit_by_name (hdwm, "long-key-press");
+
+    g_debug ("long key press!!!!");
       
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
   }
@@ -793,11 +802,117 @@
   G_OBJECT_CLASS (hd_wm_parent_class)->finalize (object);
 }
 
+static GObject *
+hd_wm_constructor (GType gtype, guint n_params, GObjectConstructParam *params)
+{
+  GObject *object;
+  HDWM *hdwm;
+  DBusConnection *connection,*sys_connection;
+  DBusError       error,sys_error;
+  gchar          *match_rule = NULL;
+
+  object = G_OBJECT_CLASS (hd_wm_parent_class)->constructor (gtype, n_params, params);
+
+  hdwm = HD_WM (object);
+
+  if (!hdwm->priv->init_dbus)
+    return object;  
+  
+  /* Setup shortcuts */
+
+  hdwm->keys = hd_keys_config_get_singleton ();
+
+  /* Get on the DBus */
+
+  dbus_error_init (&error);
+  dbus_error_init (&sys_error);
+
+  connection     = dbus_bus_get (DBUS_BUS_SESSION, &error);
+  sys_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &sys_error);
+  
+  if (!connection)
+  {
+      g_debug ("Failed to connect to DBUS: %s!\n", error.message );
+      dbus_error_free( &error );
+  }
+  else
+  {
+    match_rule = g_strdup_printf("interface='%s'", APP_LAUNCH_BANNER_METHOD_INTERFACE );
+
+    dbus_bus_add_match( connection, match_rule, NULL );
+    g_free (match_rule);
+
+    match_rule = g_strdup_printf("type='signal', interface='%s'",APPKILLER_SIGNAL_INTERFACE);
+      
+    dbus_bus_add_match( connection, match_rule, NULL );
+    dbus_connection_add_filter (connection, hd_wm_dbus_signal_handler, hdwm, NULL);
+    g_free(match_rule);
+
+    match_rule = g_strdup_printf("interface='%s'", TASKNAV_INSENSITIVE_INTERFACE );
+
+    dbus_bus_add_match (connection, match_rule, NULL );
+
+    dbus_connection_add_filter (connection, hd_wm_dbus_method_call_handler, hdwm, NULL );
+    g_free(match_rule);
+
+    match_rule = g_strdup_printf("type='signal', interface='%s'", MAEMO_LAUNCHER_SIGNAL_IFACE);
+
+    dbus_bus_add_match (connection, match_rule, NULL);
+    dbus_connection_add_filter (connection, hd_wm_dbus_signal_handler, hdwm, NULL);
+    g_free(match_rule);
+
+    dbus_connection_flush(connection);
+
+  }
+
+  if (!sys_connection)
+  {
+      g_debug ("Failed to connect to DBUS: %s!\n", sys_error.message );
+      dbus_error_free( &sys_error );
+  }
+  else
+  {
+    hd_wm_register_object_path (hdwm, 
+		    		sys_connection,
+				mce_handler,
+				MCE_SIGNAL_INTERFACE,
+				MCE_SIGNAL_PATH); 
+    
+    hd_wm_register_object_path (hdwm,
+		    		sys_connection,
+				bgkill_handler,
+				BGKILL_ON_SIGNAL_INTERFACE,
+				BGKILL_ON_SIGNAL_PATH);
+
+    hd_wm_register_object_path (hdwm,
+		    		sys_connection,
+				bgkill_handler,
+				BGKILL_OFF_SIGNAL_INTERFACE,
+				BGKILL_OFF_SIGNAL_PATH);
+    
+    hd_wm_register_object_path (hdwm,
+		    		sys_connection,
+				lowmem_handler,
+				LOWMEM_ON_SIGNAL_INTERFACE,
+				LOWMEM_ON_SIGNAL_PATH);
+
+    hd_wm_register_object_path (hdwm,
+		    		sys_connection,
+				lowmem_handler,
+				LOWMEM_OFF_SIGNAL_INTERFACE,
+				LOWMEM_OFF_SIGNAL_PATH);
+  }
+
+  return object;
+}
+
 static void 
 hd_wm_class_init (HDWMClass *hdwm_class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (hdwm_class);
 
+
+  object_class->constructor  = hd_wm_constructor;
   object_class->get_property = hd_wm_get_property;
   object_class->set_property = hd_wm_set_property;
 
@@ -908,7 +1023,7 @@
                                                         "initdbus",
                                                         "Max width when horizontal",
 	                                                TRUE,
-							G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+							G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 }
 
 static void 
@@ -978,9 +1093,6 @@
 static void 
 hd_wm_init (HDWM *hdwm)
 {
-  DBusConnection *connection,*sys_connection;
-  DBusError       error,sys_error;
-  gchar          *match_rule = NULL;
   GdkKeymap      *keymap;
   
   hdwm->priv = hdwmpriv = HD_WM_GET_PRIVATE (hdwm);
@@ -1057,94 +1169,7 @@
 
   hdwm->priv->home_info = hd_entry_info_new (HD_ENTRY_DESKTOP);
 
-
-  if (!hdwm->priv->init_dbus)
-    return;  
-
-  /* Setup shortcuts */
-
-  hdwm->keys = hd_keys_config_get_singleton ();
-
-  /* Get on the DBus */
-
-  dbus_error_init (&error);
-  dbus_error_init (&sys_error);
-
-  connection     = dbus_bus_get (DBUS_BUS_SESSION, &error);
-  sys_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &sys_error);
-  
-  if (!connection)
-  {
-      g_debug ("Failed to connect to DBUS: %s!\n", error.message );
-      dbus_error_free( &error );
-  }
-  else
-  {
-    match_rule = g_strdup_printf("interface='%s'", APP_LAUNCH_BANNER_METHOD_INTERFACE );
-
-    dbus_bus_add_match( connection, match_rule, NULL );
-    g_free (match_rule);
-
-    match_rule = g_strdup_printf("type='signal', interface='%s'",APPKILLER_SIGNAL_INTERFACE);
-      
-    dbus_bus_add_match( connection, match_rule, NULL );
-    dbus_connection_add_filter (connection, hd_wm_dbus_signal_handler, hdwm, NULL);
-    g_free(match_rule);
-
-    match_rule = g_strdup_printf("interface='%s'", TASKNAV_INSENSITIVE_INTERFACE );
-
-    dbus_bus_add_match (connection, match_rule, NULL );
-
-    dbus_connection_add_filter (connection, hd_wm_dbus_method_call_handler, hdwm, NULL );
-    g_free(match_rule);
-
-    match_rule = g_strdup_printf("type='signal', interface='%s'", MAEMO_LAUNCHER_SIGNAL_IFACE);
-
-    dbus_bus_add_match (connection, match_rule, NULL);
-    dbus_connection_add_filter (connection, hd_wm_dbus_signal_handler, hdwm, NULL);
-    g_free(match_rule);
-
-    dbus_connection_flush(connection);
-
-  }
-
-  if (!sys_connection)
-  {
-      g_debug ("Failed to connect to DBUS: %s!\n", sys_error.message );
-      dbus_error_free( &sys_error );
-  }
-  else
-  {
-    hd_wm_register_object_path (hdwm, 
-		    		sys_connection,
-				mce_handler,
-				MCE_SIGNAL_INTERFACE,
-				MCE_SIGNAL_PATH); 
-    
-    hd_wm_register_object_path (hdwm,
-		    		sys_connection,
-				bgkill_handler,
-				BGKILL_ON_SIGNAL_INTERFACE,
-				BGKILL_ON_SIGNAL_PATH);
-
-    hd_wm_register_object_path (hdwm,
-		    		sys_connection,
-				bgkill_handler,
-				BGKILL_OFF_SIGNAL_INTERFACE,
-				BGKILL_OFF_SIGNAL_PATH);
-    
-    hd_wm_register_object_path (hdwm,
-		    		sys_connection,
-				lowmem_handler,
-				LOWMEM_ON_SIGNAL_INTERFACE,
-				LOWMEM_ON_SIGNAL_PATH);
-
-    hd_wm_register_object_path (hdwm,
-		    		sys_connection,
-				lowmem_handler,
-				LOWMEM_OFF_SIGNAL_INTERFACE,
-				LOWMEM_OFF_SIGNAL_PATH);
-  }
+  hdwm->keys = NULL;
 }
 
 void

Modified: projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c	2007-03-28 11:17:16 UTC (rev 10804)
+++ projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c	2007-03-28 11:34:04 UTC (rev 10805)
@@ -322,9 +322,14 @@
         gtk_menu_shell_select_item (GTK_MENU_SHELL (app_switcher->priv->main_menu), item);	      
       }
       else 
-      if (l->data == app_switcher->priv->main_home_item)
+      if (l->data == app_switcher->priv->main_home_item &&
+	  children->next)
+      {	      
 	gtk_menu_shell_select_item (GTK_MENU_SHELL (app_switcher->priv->main_menu), 
 			            GTK_WIDGET (children->data));
+
+	app_switcher->priv->active_menu_item = GTK_WIDGET (children->data);
+      }
    }	
 	 
    return;
@@ -1077,6 +1082,8 @@
 {
   HNAppSwitcher *app_switcher = HN_APP_SWITCHER (data);
 
+  app_switcher->priv->is_thumbable = TRUE;
+
   hn_app_switcher_toggle_menu_button (app_switcher);
 }
 
@@ -1242,7 +1249,7 @@
 		    (gpointer)app_switcher);
 
   g_signal_connect (app_switcher->hdwm,
-		    "long-press-key",
+		    "long-key-press",
 		    G_CALLBACK (hn_app_switcher_long_press_cb),
 		    (gpointer)app_switcher);
 


More information about the maemo-commits mailing list