[maemo-commits] [maemo-commits] r10451 - in projects/haf/trunk/hildon-desktop: . libhildonwm src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Mar 7 23:54:16 EET 2007
- Previous message: [maemo-commits] r10450 - in projects/haf/trunk/maemo-launcher: . launcher
- Next message: [maemo-commits] r10452 - projects/haf/trunk/hildon-desktop/libhildonwm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: moimart
Date: 2007-03-07 23:54:15 +0200 (Wed, 07 Mar 2007)
New Revision: 10451
Modified:
projects/haf/trunk/hildon-desktop/ChangeLog
projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h
projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c
projects/haf/trunk/hildon-desktop/src/hn-app-switcher.h
Log:
* src/hn-app-switcher.[ch]:
- Fixed home entry info issue.
- Massive code cleanup.
* libhildonwm/hd-wm.[ch]:
- Moved home entry info to hd_wm.
- Added _finalize override.
- Code cleanup.
* ChangeLog updated.
Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog 2007-03-07 21:50:26 UTC (rev 10450)
+++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-03-07 21:54:15 UTC (rev 10451)
@@ -1,6 +1,16 @@
2007-03-07 Moises Martinez <moises.martinez at nokia.com>
+ * src/hn-app-switcher.[ch]:
+ - Fixed home entry info issue.
+ - Massive code cleanup.
* libhildonwm/hd-wm.[ch]:
+ - Moved home entry info to hd_wm.
+ - Added _finalize override.
+ - Code cleanup.
+
+2007-03-07 Moises Martinez <moises.martinez at nokia.com>
+
+ * libhildonwm/hd-wm.[ch]:
* libhildonwm/hd-wm-types-h:
* libhildonwm/hd-wm-watched-window.[ch]:
* libhildonwm/hd-entry-info.[ch]:
Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c 2007-03-07 21:50:26 UTC (rev 10450)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.c 2007-03-07 21:54:15 UTC (rev 10451)
@@ -242,6 +242,8 @@
GList *applications;
gboolean init_dbus;
+
+ HDEntryInfo *home_info;
};
static HDWMPrivate *hdwmpriv = NULL; /* Singleton instance */
@@ -623,6 +625,25 @@
}
static void
+hd_wm_finalize (GObject *object)
+{
+ HDWM *hdwm = HD_WM (object);
+
+ hd_entry_info_free (hdwm->priv->home_info);
+
+ g_hash_table_destroy (hdwm->priv->watched_windows);
+ g_hash_table_destroy (hdwm->priv->watched_windows_hibernating);
+
+ gdk_window_remove_filter (gdk_get_default_root_window(),
+ hd_wm_x_event_filter,
+ hdwm);
+
+ g_object_unref (G_OBJECT (hdwm->keys));
+
+ G_OBJECT_CLASS (hd_wm_parent_class)->finalize (object);
+}
+
+static void
hd_wm_class_init (HDWMClass *hdwm_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (hdwm_class);
@@ -630,6 +651,8 @@
object_class->get_property = hd_wm_get_property;
object_class->set_property = hd_wm_set_property;
+ object_class->finalize = hd_wm_finalize;
+
g_type_class_add_private (hdwm_class, sizeof (HDWMPrivate));
hdwm_signals[HDWM_ENTRY_INFO_CHANGE_SIGNAL] =
@@ -848,20 +871,16 @@
/* select X events */
- gdk_window_set_events(gdk_get_default_root_window (),
- gdk_window_get_events(gdk_get_default_root_window())
- | GDK_PROPERTY_CHANGE_MASK );
+ gdk_window_set_events (gdk_get_default_root_window (),
+ gdk_window_get_events(gdk_get_default_root_window())
+ | GDK_PROPERTY_CHANGE_MASK );
- gdk_window_add_filter(gdk_get_default_root_window(),
- hd_wm_x_event_filter,
- hdwm);
+ gdk_window_add_filter (gdk_get_default_root_window(),
+ hd_wm_x_event_filter,
+ hdwm);
gdk_error_trap_pop();
- /* Setup shortcuts */
-
- hdwm->keys = hd_keys_config_get_singleton ();
-
/* Track changes in the keymap */
keymap = gdk_keymap_get_default ();
@@ -870,10 +889,16 @@
G_CALLBACK (hd_keys_reload),
hdwm->keys);
+ 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);
@@ -1027,6 +1052,12 @@
g_debug ("### Invalid window type ###\n");
}
+HDEntryInfo *
+hd_wm_get_home_info (HDWM *hdwm)
+{
+ return hdwm->priv->home_info;
+}
+
void
hd_wm_activate_service (const gchar *app, const gchar *parameters)
{
Modified: projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h 2007-03-07 21:50:26 UTC (rev 10450)
+++ projects/haf/trunk/hildon-desktop/libhildonwm/hd-wm.h 2007-03-07 21:54:15 UTC (rev 10451)
@@ -177,28 +177,35 @@
HDWM *
hd_wm_get_singleton_without_dbus (void);
+HDEntryInfo *
+hd_wm_get_home_info (HDWM *hdwm);
+
/** Send 'top' request for a certain existing window/view
*
* @param info the window/view to be topped
*
*/
-void hd_wm_top_item (HDEntryInfo *info);
+void
+hd_wm_top_item (HDEntryInfo *info);
/** Send 'top' request for a certain service
* @param service_name The name of the service that is to be topped
*/
-gboolean hd_wm_top_service(const gchar *service_name);
+gboolean
+hd_wm_top_service(const gchar *service_name);
/**
* Requests the real window manager to top the desktop
*/
-void hd_wm_top_desktop(void);
+void
+hd_wm_top_desktop(void);
/**
* Toggle between desktop and the last active application
*/
-void hd_wm_toggle_desktop (void);
+void
+hd_wm_toggle_desktop (void);
HDWMWatchedWindow*
hd_wm_lookup_watched_window_via_service (const gchar *service_name);
Modified: projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c 2007-03-07 21:50:26 UTC (rev 10450)
+++ projects/haf/trunk/hildon-desktop/src/hn-app-switcher.c 2007-03-07 21:54:15 UTC (rev 10451)
@@ -288,6 +288,21 @@
}
static void
+hn_app_switcher_toggle_menu_button (HNAppSwitcher *app_switcher)
+{
+
+ g_return_if_fail (HN_IS_APP_SWITCHER (app_switcher));
+
+ if (!hd_wm_get_applications (app_switcher->hdwm))
+ return;
+
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON (app_switcher->priv->main_button), TRUE);
+
+ g_signal_emit_by_name (app_switcher->priv->main_button, "toggled");
+}
+
+static void
hn_app_image_animation (GtkWidget *icon,
gboolean is_on)
{
@@ -807,8 +822,9 @@
event->keyval == GDK_KP_Right ||
event->keyval == GDK_KP_Enter)
{
+
hn_app_switcher_toggle_menu_button (app_switcher);
-
+
return TRUE;
}
else
@@ -1117,8 +1133,7 @@
g_object_ref (app_switcher->hdwm);
- if (!app_switcher->priv->home_info)
- app_switcher->priv->home_info = hd_entry_info_new (HD_ENTRY_DESKTOP);
+ app_switcher->priv->home_info = hd_wm_get_home_info (app_switcher->hdwm);
gtk_widget_push_composite_child ();
@@ -1923,9 +1938,6 @@
osso_deinitialize (priv->osso);
#endif
- if (priv->home_info)
- hd_entry_info_free (priv->home_info);
-
g_object_unref (app_switch->hdwm);
g_debug ("Destroying HNAppSwitcher");
@@ -2043,70 +2055,12 @@
hn_app_switcher_init_sound_samples (app_switcher);
}
-
-/* Public API */
-
GtkWidget *
hn_app_switcher_new (gint nitems)
{
return g_object_new (HN_TYPE_APP_SWITCHER,"n_items",nitems,NULL);
}
-GList *
-hn_app_switcher_get_entries (HNAppSwitcher *app_switcher)
-{
- HNAppSwitcherPrivate *priv;
- GList *retlist, *l;
-
- g_return_val_if_fail (HN_IS_APP_SWITCHER (app_switcher), NULL);
- priv = app_switcher->priv;
-
- retlist = NULL;
- for (l = priv->applications; l != NULL; l = l->next)
- retlist = g_list_prepend (retlist, l->data);
-
- return g_list_reverse (retlist);
-}
-
-void
-hn_app_switcher_foreach_entry (HNAppSwitcher *app_switcher,
- HNAppSwitcherForeachFunc func,
- gpointer data)
-{
- HNAppSwitcherPrivate *priv;
- GList *entries, *l;
-
- g_return_if_fail (HN_IS_APP_SWITCHER (app_switcher));
- g_return_if_fail (func != NULL);
-
- priv = app_switcher->priv;
- entries = hd_wm_get_applications (app_switcher->hdwm);
-
- for (l = entries; l != NULL; l = l->next)
- {
- HDEntryInfo *info = l->data;
-
- if (!(* func) (info, data))
- break;
- }
-}
-
-
-void
-hn_app_switcher_toggle_menu_button (HNAppSwitcher *app_switcher)
-{
- HNAppSwitcherPrivate *priv;
-
- g_return_if_fail (HN_IS_APP_SWITCHER (app_switcher));
- priv = app_switcher->priv;
-
- if (!hd_wm_get_applications (app_switcher->hdwm))
- return;
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->main_button), TRUE);
- g_signal_emit_by_name (priv->main_button, "toggled");
-}
-
gboolean
hn_app_switcher_get_system_inactivity (HNAppSwitcher *app_switcher)
{
@@ -2118,11 +2072,3 @@
return priv->system_inactivity;
}
-HDEntryInfo *
-hn_app_switcher_get_home_entry_info (HNAppSwitcher *app_switcher)
-{
- g_return_val_if_fail (app_switcher, NULL);
-
- return app_switcher->priv->home_info;
-}
-
Modified: projects/haf/trunk/hildon-desktop/src/hn-app-switcher.h
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hn-app-switcher.h 2007-03-07 21:50:26 UTC (rev 10450)
+++ projects/haf/trunk/hildon-desktop/src/hn-app-switcher.h 2007-03-07 21:54:15 UTC (rev 10451)
@@ -79,19 +79,11 @@
GtkWidget *hn_app_switcher_new (gint nitems);
-GList * hn_app_switcher_get_entries (HNAppSwitcher *app_switcher);
-void hn_app_switcher_foreach_entry (HNAppSwitcher *app_switcher,
- HNAppSwitcherForeachFunc func,
- gpointer data);
-
-void hn_app_switcher_toggle_menu_button (HNAppSwitcher *app_switcher);
-
gboolean hn_app_switcher_get_system_inactivity (HNAppSwitcher *app_switcher);
gboolean hn_app_switcher_menu_button_release_cb (GtkWidget *widget,
GdkEventButton *event);
-HDEntryInfo * hn_app_switcher_get_home_entry_info (HNAppSwitcher *as);
G_END_DECLS
- Previous message: [maemo-commits] r10450 - in projects/haf/trunk/maemo-launcher: . launcher
- Next message: [maemo-commits] r10452 - projects/haf/trunk/hildon-desktop/libhildonwm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
