[maemo-commits] [maemo-commits] r9289 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jan 24 14:56:51 EET 2007
Author: jobi
Date: 2007-01-24 14:56:50 +0200 (Wed, 24 Jan 2007)
New Revision: 9289

Modified:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-others-button.c
Log:

2007-01-24  Johan Bilien  <johan.bilien at nokia.com>

	* src/others-button.c: Position menu according to panel orientation



Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-01-24 12:49:30 UTC (rev 9288)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-01-24 12:56:50 UTC (rev 9289)
@@ -1,3 +1,7 @@
+2007-01-24  Johan Bilien  <johan.bilien at nokia.com>
+
+	* src/others-button.c: Position menu according to panel orientation
+
 2007-01-24  Moises Martinez  <moises.martinez at nokia.com>
 
 	* libhildondesktop/hildon-desktop-panel.[ch]:

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-others-button.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-others-button.c	2007-01-24 12:49:30 UTC (rev 9288)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-others-button.c	2007-01-24 12:56:50 UTC (rev 9289)
@@ -42,6 +42,7 @@
 #include <hildon-base-lib/hildon-base-dnotify.h>
 #include <hildon-widgets/hildon-finger.h>
 #include <libhildondesktop/libhildonmenu.h>
+#include <libhildondesktop/hildon-desktop-panel-window.h>
 #include <libhildondesktop/hildon-thumb-menu-item.h>
 #include <libhildonwm/hd-wm.h>
 
@@ -743,25 +744,58 @@
   int menu_height = 0;
   int main_height = 0;
   GtkAllocation workarea = { 0, 0, 0, 0 };
+  GtkWidget *top_level;
+  HildonDesktopPanelWindowOrientation orientation = 
+      HILDON_DESKTOP_PANEL_WINDOW_ORIENTATION_LEFT;
     
   hn_others_button_get_workarea (&workarea);
+  
+  *push_in = FALSE;
+
+  top_level = gtk_widget_get_toplevel (button);
+
+  if (HILDON_DESKTOP_IS_PANEL_WINDOW (top_level))
+  {
+    g_object_get (top_level, "orientation", &orientation, NULL);
+  }
     
   gtk_widget_size_request (GTK_WIDGET (menu), &req);
 
   menu_height = req.height;
   main_height = gdk_screen_get_height (screen);
 
-  *push_in = FALSE;
-  *x =  workarea.x;
+  switch (orientation)
+  {
+    case HILDON_DESKTOP_PANEL_WINDOW_ORIENTATION_LEFT:
+        *x =  workarea.x;
 
-  if (main_height - button->allocation.y < menu_height)
-  {
-    *y = MAX(0, ((main_height - menu_height) / 2));
+        if (main_height - button->allocation.y < menu_height)
+          *y = MAX(0, ((main_height - menu_height) / 2));
+        else
+          *y = button->allocation.y;
+        
+        break;
+
+    case HILDON_DESKTOP_PANEL_WINDOW_ORIENTATION_RIGHT:
+        *x =  workarea.x + workarea.width - req.width;
+
+        if (main_height - button->allocation.y < menu_height)
+          *y = MAX(0, ((main_height - menu_height) / 2));
+        else
+          *y = button->allocation.y;
+        
+        break;
+    case HILDON_DESKTOP_PANEL_WINDOW_ORIENTATION_TOP:
+        *x = button->allocation.x;
+        *y = workarea.y;
+        break;
+    case HILDON_DESKTOP_PANEL_WINDOW_ORIENTATION_BOTTOM:
+        *x = button->allocation.x;
+        *y = workarea.y + workarea.width - req.height;
+    default:
+        g_assert_not_reached ();
   }
-  else
-  {
-    *y = button->allocation.y;
-  }
+
 }
 
 static void


More information about the maemo-commits mailing list