[Pkg-maemo-commits] r305 ./hildon-desktop/ubuntu: remove floating statusbar and insert statusbar to marquee

Horace Li horace.li at intel.com
Fri Nov 30 15:17:30 UTC 2007


------------------------------------------------------------
revno: 305
committer: Horace Li <horace.li at intel.com>
branch nick: ubuntu
timestamp: Thu 2007-08-30 13:43:31 +0800
message:
  remove floating statusbar and insert statusbar to marquee
added:
  data/statusbar-container.desktop.in
  src/hm-statusbar-container.c
  src/hm-statusbar-container.h
modified:
  configure.ac
  data/Makefile.am
  data/desktop.conf.in
  data/marquee.conf.in
  debian/changelog
  src/Makefile.am
  src/hd-plugin-loader-builtin.c
-------------- next part --------------
=== added file 'data/statusbar-container.desktop.in'
--- a/data/statusbar-container.desktop.in	1970-01-01 00:00:00 +0000
+++ b/data/statusbar-container.desktop.in	2007-08-30 05:43:31 +0000
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Name=Statusbar Container
+Type=builtin
+X-Path=statusbarcontainer

=== added file 'src/hm-statusbar-container.c'
--- a/src/hm-statusbar-container.c	1970-01-01 00:00:00 +0000
+++ b/src/hm-statusbar-container.c	2007-08-30 05:43:31 +0000
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2007 Intel Corporation
+ *
+ * Author:  Horace Li <horace.li at intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <gtk/gtk.h>
+#include <glib-object.h>
+#include <libhildondesktop/libhildondesktop.h>
+#include <libhildondesktop/hildon-desktop-panel-window-dialog.h>
+#include <libhildondesktop/hildon-desktop-panel-expandable.h>
+
+#include "hm-statusbar-container.h"
+#include "hd-plugin-manager.h"
+#include "hd-config.h"
+
+#define THEME_DIR "/usr/share/themes/mobilebasic"
+#define STATUSBAR_CONFIG "/etc/hildon-desktop/statusbar.conf"
+#define HD_PANEL_WINDOW_DIALOG_BUTTON_NAME  "HildonStatusBarItem"
+
+#define HM_STATUSBAR_CONTAINER_GET_PRIVATE(obj) \
+        (G_TYPE_INSTANCE_GET_PRIVATE ((obj), HM_TYPE_STATUSBAR_CONTAINER, StatusbarContainerPrivate))
+
+G_DEFINE_TYPE (StatusbarContainer, statusbar_container, TASKNAVIGATOR_TYPE_ITEM);
+
+struct _StatusbarContainerPrivate 
+{
+   HDWM *hdwm;
+
+   GtkContainer *statusbar;
+   GObject *pm;
+};
+
+static void statusbar_container_finalize (GObject *object);
+
+static GList *
+plugin_list_from_conf (const gchar *config_file)
+{
+  GKeyFile *keyfile;
+  gchar **groups;
+  gboolean is_to_load = TRUE;
+  GList *plugin_list = NULL;
+  GError *error = NULL;
+  gint i;
+
+  g_return_val_if_fail (config_file != NULL, NULL);
+
+  keyfile = g_key_file_new ();
+
+  g_key_file_load_from_file (keyfile,
+                             config_file,
+                             G_KEY_FILE_NONE,
+                             &error);
+
+  if (error)
+  {
+    g_warning ("Error loading container configuration file %s: %s", config_file, error->message);
+    g_error_free (error);
+
+    return NULL;
+  }
+
+  groups = g_key_file_get_groups (keyfile, NULL);
+
+  for (i = 0; groups[i]; i++)
+  {
+    is_to_load = g_key_file_get_boolean (keyfile,
+                                         groups[i],
+                                         HD_DESKTOP_CONFIG_KEY_LOAD,
+                                         &error);
+
+    if (error)
+    {
+      is_to_load = TRUE;
+      g_error_free (error);
+      error = NULL;
+    }
+
+    if (is_to_load)
+      plugin_list = g_list_append (plugin_list, groups[i]);
+  }
+
+  g_free (groups);
+  g_key_file_free (keyfile);
+
+  return plugin_list;
+}
+
+static void
+hm_statusbar_container_cadd (HildonDesktopPanelExpandable *container,
+                      GtkWidget *widget,
+                      gpointer user_data)
+{
+  gtk_widget_set_name (widget, HD_PANEL_WINDOW_DIALOG_BUTTON_NAME);
+  gtk_widget_set_name (GTK_BIN (widget)->child, HD_PANEL_WINDOW_DIALOG_BUTTON_NAME);
+}
+
+static void statusbar_container_init (StatusbarContainer *statusbar_container)
+{
+   GtkContainer *statusbar = NULL;
+   int scn_width = 800;
+   GdkScreen *screen = NULL;
+   GList *plugin_list = NULL;
+
+   StatusbarContainerPrivate *priv = HM_STATUSBAR_CONTAINER_GET_PRIVATE (statusbar_container);
+
+   statusbar_container->priv = priv;
+   statusbar_container->priv->hdwm = hd_wm_get_singleton ();
+   statusbar_container->priv->pm = hd_plugin_manager_new ();
+
+   g_object_ref (statusbar_container->priv->hdwm);
+   gtk_widget_push_composite_child ();
+
+   statusbar = g_object_new (HILDON_DESKTOP_TYPE_PANEL_EXPANDABLE, "items_row", 7,NULL);
+
+   //Hard code orientation as horizontal first, this should get from marquee orientation ultmately.
+   if (NULL != statusbar)
+   {
+       g_signal_connect (G_OBJECT (statusbar),
+                    "queued-button",
+                    G_CALLBACK (hm_statusbar_container_cadd),
+                    NULL);
+
+       g_object_set (G_OBJECT (statusbar),
+                  "orientation",
+                  GTK_ORIENTATION_HORIZONTAL,
+                  NULL);
+   }
+
+   screen = gtk_widget_get_screen ((GtkWidget*)statusbar_container);
+   if (screen != NULL) {
+      scn_width = gdk_screen_get_width(screen);
+   }
+
+   gtk_widget_set_size_request ((GtkWidget*)statusbar_container, (scn_width == 1024?303:200), 52);
+
+   plugin_list = plugin_list_from_conf (STATUSBAR_CONFIG);
+   hd_plugin_manager_load (HD_PLUGIN_MANAGER (statusbar_container->priv->pm),
+                           plugin_list,
+                           statusbar,
+                           NULL);
+
+   statusbar_container->priv->statusbar = statusbar;
+
+   gtk_container_add (GTK_CONTAINER(statusbar_container), GTK_WIDGET(statusbar));
+   gtk_widget_show_all(GTK_WIDGET(statusbar));
+
+   gtk_widget_pop_composite_child ();
+}
+
+static void statusbar_container_class_init (StatusbarContainerClass *class)
+{
+  GObjectClass   *object_class = G_OBJECT_CLASS (class);
+  object_class->finalize    = statusbar_container_finalize;
+  g_type_class_add_private (object_class, sizeof (StatusbarContainerPrivate));
+}
+
+static void statusbar_container_finalize (GObject *object)
+{
+   g_return_if_fail (object != NULL);
+   g_return_if_fail (IS_STATUSBAR_CONTAINER (object));
+
+   StatusbarContainer *statusbar_container = STATUSBAR_CONTAINER (object);
+   StatusbarContainerPrivate *priv = HM_STATUSBAR_CONTAINER_GET_PRIVATE (statusbar_container);
+
+   if (priv->pm != NULL)
+   {
+       g_object_unref (priv->pm);
+       priv->pm = NULL;
+   }
+
+   G_OBJECT_CLASS (statusbar_container_parent_class)->finalize (object);
+}

=== added file 'src/hm-statusbar-container.h'
--- a/src/hm-statusbar-container.h	1970-01-01 00:00:00 +0000
+++ b/src/hm-statusbar-container.h	2007-08-30 05:43:31 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 Intel Corporation
+ *
+ * Author:  Horace Li <horace.li at intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef STATUSBAR_CONTAINER_H
+#define STATUSBAR_CONTAINER_H
+
+#include <glib-object.h>
+#include <libhildondesktop/tasknavigator-item.h>
+#include <libhildonwm/hd-wm.h>
+
+G_BEGIN_DECLS
+
+typedef struct _StatusbarContainer StatusbarContainer;
+typedef struct _StatusbarContainerClass StatusbarContainerClass;
+typedef struct _StatusbarContainerPrivate StatusbarContainerPrivate;
+
+#define HM_TYPE_STATUSBAR_CONTAINER         (statusbar_container_get_type ())
+#define STATUSBAR_CONTAINER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), HM_TYPE_STATUSBAR_CONTAINER, StatusbarContainer))
+#define STATUSBAR_CONTAINER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  HM_TYPE_STATUSBAR_CONTAINER, StatusbarContainerClass))
+#define IS_STATUSBAR_CONTAINER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HM_TYPE_STATUSBAR_CONTAINER))
+#define IS_STATUSBAR_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  HM_TYPE_STATUSBAR_CONTAINER))
+#define STATUSBAR_CONTAINER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  HM_TYPE_STATUSBAR_CONTAINER, StatusbarContainerClass))
+
+struct _StatusbarContainer
+{
+   TaskNavigatorItem tnitem;
+   StatusbarContainerPrivate *priv;
+};
+
+struct _StatusbarContainerClass
+{
+   TaskNavigatorItemClass parent_class;
+};
+
+GType  statusbar_container_get_type  (void);
+
+G_END_DECLS
+
+#endif //STATUSBAR_CONTAINER_H

=== modified file 'configure.ac'
--- a/configure.ac	2007-07-19 18:07:34 +0000
+++ b/configure.ac	2007-08-30 05:43:31 +0000
@@ -294,5 +294,6 @@
 data/others-button.desktop 
 data/applications-menu.desktop 
 data/switcher-menu.desktop
+data/statusbar-container.desktop
 policies/Makefile
 ])

=== modified file 'data/Makefile.am'
--- a/data/Makefile.am	2007-07-19 18:07:03 +0000
+++ b/data/Makefile.am	2007-08-30 05:43:31 +0000
@@ -13,7 +13,8 @@
 	switcher-menu.desktop
 
 hildonmarqueedesktopentry_DATA = \
-        applications-menu.desktop
+        applications-menu.desktop  \
+        statusbar-container.desktop
 
 #hildondesktopmenu_DATA = applications.menu
 

=== modified file 'data/desktop.conf.in'
--- a/data/desktop.conf.in	2007-08-29 16:09:01 +0000
+++ b/data/desktop.conf.in	2007-08-30 05:43:31 +0000
@@ -20,15 +20,15 @@
 X-Config-File=home.conf
 X-Plugin-Dir=@hildonhomedesktopentrydir@
 
-[Statusbar]
-X-Type=panel_expandable
-X-Position-X=670
-X-Position-Y=1
-X-Size-Width=303
-X-Size-Height=50
-X-Orientation=top
-X-Is-Ordered=1
-X-Config-File=statusbar.conf
-X-Plugin-Dir=@hildonstatusbardesktopentrydir@
+#[Statusbar]
+#X-Type=panel_expandable
+#X-Position-X=670
+#X-Position-Y=1
+#X-Size-Width=303
+#X-Size-Height=50
+#X-Orientation=top
+#X-Is-Ordered=1
+#X-Config-File=statusbar.conf
+#X-Plugin-Dir=@hildonstatusbardesktopentrydir@
 
 

=== modified file 'data/marquee.conf.in'
--- a/data/marquee.conf.in	2007-08-29 16:00:24 +0000
+++ b/data/marquee.conf.in	2007-08-30 05:43:31 +0000
@@ -3,6 +3,6 @@
 [@hildonmarqueedesktopentrydir@/nav-prev-app.desktop]
 [@hildonmarqueedesktopentrydir@/clock-plugin.desktop]
 [@hildonmarqueedesktopentrydir@/nav-next-app.desktop]
-[@hildonmarqueedesktopentrydir@/statusbar-plugin.desktop]
+[@hildonmarqueedesktopentrydir@/statusbar-container.desktop]
 [@hildonmarqueedesktopentrydir@/close-app.desktop]
 #[@hildonmarqueedesktopentrydir@/dummy-panel.desktop]

=== modified file 'debian/changelog'
--- a/debian/changelog	2007-08-29 16:12:54 +0000
+++ b/debian/changelog	2007-08-30 05:43:31 +0000
@@ -1,3 +1,10 @@
+hildon-desktop (0.0.21-1ubuntu5) UNRELEASED; urgency=low
+
+  * Remove floating statusbar, and insert a statusbar container to 
+    marquee panel to load statusbar.
+
+ -- Horace Li <horace.li at intel.com>  Thu, 30 Aug 2007 13:28:42 +0800
+
 hildon-desktop (0.0.21-1ubuntu4) UNRELEASED; urgency=low
 
   [ Rusty Lynch ]

=== modified file 'src/Makefile.am'
--- a/src/Makefile.am	2007-07-02 13:14:24 +0000
+++ b/src/Makefile.am	2007-08-30 05:43:31 +0000
@@ -92,6 +92,10 @@
 	hn-others-button.c \
 	hn-others-button.h
 
+STATUSBAR_SOURCES  = \
+	hm-statusbar-container.c \
+	hm-statusbar-container.h
+
 APPLICATIONS_MENU_SOURCES  = \
 	hd-applications-menu.c \
 	hd-applications-menu.h
@@ -103,6 +107,7 @@
 	$(APP_SWITCHER_SOURCES)      \
 	$(APPLICATIONS_MENU_SOURCES) \
 	$(OTHERS_BUTTON_SOURCES)     \
+	$(STATUSBAR_SOURCES)         \
 	hd-desktop.c                 \
 	hd-desktop.h                 \
 	hd-select-plugins-dialog.c   \

=== modified file 'src/hd-plugin-loader-builtin.c'
--- a/src/hd-plugin-loader-builtin.c	2007-05-22 11:54:44 +0000
+++ b/src/hd-plugin-loader-builtin.c	2007-08-30 05:43:31 +0000
@@ -32,6 +32,7 @@
 #include "hn-others-button.h"
 #include "hd-applications-menu.h"
 #include "hd-switcher-menu.h"
+#include "hm-statusbar-container.h"
 
 #define HD_PLUGIN_LOADER_BUILTIN_GET_PRIVATE(obj) \
         (G_TYPE_INSTANCE_GET_PRIVATE ((obj), HD_TYPE_PLUGIN_LOADER_BUILTIN, HDPluginLoaderBuiltinPrivate))
@@ -42,6 +43,7 @@
 #define HD_PLUGIN_LOADER_BUILTIN_OTHERS_BUTTON     "othersbutton"
 #define HD_PLUGIN_LOADER_BUILTIN_APPLICATIONS_MENU "applicationsmenu"
 #define HD_PLUGIN_LOADER_BUILTIN_SWITCHER_MENU     "switchermenu"
+#define HD_PLUGIN_LOADER_BUILTIN_STATUSBAR_CONTAINER "statusbarcontainer"
 
 static GList *
 hd_plugin_loader_builtin_load (HDPluginLoader *loader, GError **error)
@@ -101,7 +103,13 @@
     GObject *object = g_object_new (HD_TYPE_SWITCHER_MENU, NULL);
 
     objects = g_list_append (objects, object);
-  }	  
+  }	
+  else if (!g_ascii_strcasecmp (path, HD_PLUGIN_LOADER_BUILTIN_STATUSBAR_CONTAINER))
+  {
+    GObject *object = g_object_new (HM_TYPE_STATUSBAR_CONTAINER, NULL);
+
+    objects = g_list_append (objects, object);
+  }  
 
   g_free (path);
   



More information about the pkg-maemo-commits mailing list