Updating branch refs/heads/nick/gtk3
         to dfa591b84694c5d2bb8b8c534359da9281e35d6a (commit)
       from 4fefed2c3dd242cc2cb9d7d4f59aba1ee130a996 (commit)

commit dfa591b84694c5d2bb8b8c534359da9281e35d6a
Author: Andrzej <ndrwr...@gmail.com>
Date:   Thu Apr 11 21:24:48 2013 +0100

    Pager: ported to Gtk3
    
    WnckPager needs a similar functionality to the one added in libwnck-2.31
    to correctly resize the pager widget in a deskbar mode.
    Perhaps that can be emulated with gtk3+ height_for_width/width_for_height
    mechanism.

 plugins/pager/pager-buttons.c |   36 ++++++++++++------------------------
 plugins/pager/pager.c         |   10 +++-------
 2 files changed, 15 insertions(+), 31 deletions(-)

diff --git a/plugins/pager/pager-buttons.c b/plugins/pager/pager-buttons.c
index c2f434c..2a4f190 100644
--- a/plugins/pager/pager-buttons.c
+++ b/plugins/pager/pager-buttons.c
@@ -61,12 +61,12 @@ static void pager_buttons_viewport_button_toggled    
(GtkWidget     *button,
 
 struct _PagerButtonsClass
 {
-  GtkTableClass __parent__;
+  GtkGridClass    __parent__;
 };
 
 struct _PagerButtons
 {
-  GtkTable __parent__;
+  GtkGrid         __parent__;
 
   GSList         *buttons;
 
@@ -95,7 +95,7 @@ enum
 
 
 
-XFCE_PANEL_DEFINE_TYPE (PagerButtons, pager_buttons, GTK_TYPE_TABLE)
+XFCE_PANEL_DEFINE_TYPE (PagerButtons, pager_buttons, GTK_TYPE_GRID)
 
 
 
@@ -147,7 +147,9 @@ pager_buttons_init (PagerButtons *pager)
   /* although I'd prefer normal allocation, the homogeneous setting
    * takes care of small panels, while non-homogeneous tables allocate
    * outside the panel size --nick */
-  gtk_table_set_homogeneous (GTK_TABLE (pager), TRUE);
+  /* gtk_table_set_homogeneous (GTK_TABLE (pager), TRUE); */
+  gtk_grid_set_row_homogeneous (GTK_GRID (pager), TRUE);
+  gtk_grid_set_column_homogeneous (GTK_GRID (pager), TRUE);
 }
 
 
@@ -294,8 +296,6 @@ pager_buttons_rebuild_idle (gpointer user_data)
   panel_return_val_if_fail (XFCE_IS_PAGER_BUTTONS (pager), FALSE);
   panel_return_val_if_fail (WNCK_IS_SCREEN (pager->wnck_screen), FALSE);
 
-  GDK_THREADS_ENTER ();
-
   gtk_container_foreach (GTK_CONTAINER (pager),
       (GtkCallback) gtk_widget_destroy, NULL);
 
@@ -351,11 +351,6 @@ pager_buttons_rebuild_idle (gpointer user_data)
         cols++;
     }
 
-  if (pager->orientation == GTK_ORIENTATION_HORIZONTAL)
-    gtk_table_resize (GTK_TABLE (pager), rows, cols);
-  else
-    gtk_table_resize (GTK_TABLE (pager), cols, rows);
-
 
   panel_plugin = gtk_widget_get_ancestor (GTK_WIDGET (pager), 
XFCE_TYPE_PANEL_PLUGIN);
 
@@ -404,11 +399,8 @@ pager_buttons_rebuild_idle (gpointer user_data)
               col = n % cols;
             }
 
-
-          gtk_table_attach (GTK_TABLE (pager), button,
-                            row, row + 1, col, col + 1,
-                            GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
-                            0, 0);
+          gtk_grid_attach (GTK_GRID (pager), button,
+                           row, col, 1, 1);
         }
     }
   else
@@ -449,10 +441,8 @@ pager_buttons_rebuild_idle (gpointer user_data)
               col = n % cols;
             }
 
-          gtk_table_attach (GTK_TABLE (pager), button,
-                            row, row + 1, col, col + 1,
-                            GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
-                            0, 0);
+          gtk_grid_attach (GTK_GRID (pager), button,
+                           row, col, 1, 1);
         }
     }
 
@@ -460,8 +450,6 @@ pager_buttons_rebuild_idle (gpointer user_data)
 
   leave:
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -482,8 +470,8 @@ pager_buttons_queue_rebuild (PagerButtons *pager)
 
   if (pager->rebuild_id == 0)
     {
-      pager->rebuild_id = g_idle_add_full (G_PRIORITY_LOW, 
pager_buttons_rebuild_idle,
-                                           pager, 
pager_buttons_rebuild_idle_destroyed);
+      pager->rebuild_id = gdk_threads_add_idle_full (G_PRIORITY_LOW, 
pager_buttons_rebuild_idle,
+                                                     pager, 
pager_buttons_rebuild_idle_destroyed);
     }
 }
 
diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c
index 28195a4..950fad9 100644
--- a/plugins/pager/pager.c
+++ b/plugins/pager/pager.c
@@ -297,19 +297,17 @@ pager_plugin_screen_layout_changed (PagerPlugin *plugin)
 
   if (plugin->miniature_view)
     {
-      plugin->pager = wnck_pager_new (plugin->wnck_screen);
+      plugin->pager = wnck_pager_new ();
       wnck_pager_set_display_mode (WNCK_PAGER (plugin->pager), 
WNCK_PAGER_DISPLAY_CONTENT);
       if (!wnck_pager_set_n_rows (WNCK_PAGER (plugin->pager), plugin->rows))
         g_message ("Setting the pager rows returned false. Maybe the setting 
is not applied.");
 
-#ifdef WNCK_CHECK_VERSION
-#if WNCK_CHECK_VERSION (2,31,0)
+#if 0
       wnck_pager_set_layout_policy (WNCK_PAGER (plugin->pager),
                                     (mode == 
XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) ?
                                     WNCK_PAGER_LAYOUT_POLICY_WIDTH_FOR_HEIGHT :
                                     WNCK_PAGER_LAYOUT_POLICY_HEIGHT_FOR_WIDTH);
 #endif
-#endif
       wnck_pager_set_orientation (WNCK_PAGER (plugin->pager), orientation);
     }
   else
@@ -421,14 +419,12 @@ pager_plugin_mode_changed (XfcePanelPlugin     
*panel_plugin,
 
   if (plugin->miniature_view)
     {
-#ifdef WNCK_CHECK_VERSION
-#if WNCK_CHECK_VERSION (2,31,0)
+#if 0
       wnck_pager_set_layout_policy (WNCK_PAGER (plugin->pager),
                                     (mode == 
XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) ?
                                     WNCK_PAGER_LAYOUT_POLICY_WIDTH_FOR_HEIGHT :
                                     WNCK_PAGER_LAYOUT_POLICY_HEIGHT_FOR_WIDTH);
 #endif
-#endif
       wnck_pager_set_orientation (WNCK_PAGER (plugin->pager), orientation);
     }
   else
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to