[gupnp-tools] Remove deprecated functions for 3.22



commit 2d8644a69866fe7941ef7283e5723bf4c1c20d89
Author: Jens Georg <mail jensge org>
Date:   Mon Nov 21 23:21:11 2016 +0100

    Remove deprecated functions for 3.22
    
    Signed-off-by: Jens Georg <mail jensge org>

 src/av-cp/gui.c                     |   24 +++++++++++++++++++++---
 src/av-cp/playlist-treeview.c       |    4 ++++
 src/network-light/gui.c             |    4 ++++
 src/universal-cp/details-treeview.c |    4 ++++
 src/universal-cp/device-treeview.c  |    4 ++++
 src/universal-cp/event-treeview.c   |    4 ++++
 src/universal-cp/gui.c              |   24 ++++++++++++++++++++++--
 7 files changed, 63 insertions(+), 5 deletions(-)
---
diff --git a/src/av-cp/gui.c b/src/av-cp/gui.c
index f1385ae..d1422dd 100644
--- a/src/av-cp/gui.c
+++ b/src/av-cp/gui.c
@@ -116,9 +116,29 @@ init_ui (void)
                                                             "rescan-button"));
         g_assert (rescan_button != NULL);
 
+
+        gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (about_dialog),
+                                      VERSION);
+
+        gtk_widget_realize (main_window);
         /* 40% of the screen but don't get bigger than 1000x800 */
+#if GTK_CHECK_VERSION(3,22,0)
+        {
+            GdkWindow *window = gtk_widget_get_window (main_window);
+            GdkDisplay *display = gdk_display_get_default ();
+            GdkMonitor *monitor = gdk_display_get_monitor_at_window (display,
+                                                                     window);
+            GdkRectangle rectangle;
+
+            gdk_monitor_get_geometry (monitor, &rectangle);
+            w = rectangle.width * 0.4;
+            h = rectangle.height * 0.4;
+        }
+
+#else
         w = gdk_screen_width () * 0.4;
         h = gdk_screen_height () * 0.4;
+#endif
 
         /* Keep 5/4 aspect */
         if (w/h > 1.25) {
@@ -133,9 +153,6 @@ init_ui (void)
                                      window_width,
                                      window_height);
 
-        gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (about_dialog),
-                                      VERSION);
-
         gtk_builder_connect_signals (builder, NULL);
 
         setup_icons (builder);
@@ -143,6 +160,7 @@ init_ui (void)
         setup_renderer_controls (builder);
         setup_renderer_combo (builder);
 
+
         gtk_widget_show_all (main_window);
 
         return TRUE;
diff --git a/src/av-cp/playlist-treeview.c b/src/av-cp/playlist-treeview.c
index f5a0bee..cf4deaf 100644
--- a/src/av-cp/playlist-treeview.c
+++ b/src/av-cp/playlist-treeview.c
@@ -156,6 +156,9 @@ browse (AVCPMediaServer *content_dir,
 static void
 do_popup_menu (GtkMenu *menu, GtkWidget *widget, GdkEventButton *event)
 {
+#if GTK_CHECK_VERSION(3,22,0)
+        gtk_menu_popup_at_pointer (menu, (event != NULL) ? (GdkEvent *) event : gtk_get_current_event ());
+#else
         int button = 0;
         int event_time;
         if (event) {
@@ -166,6 +169,7 @@ do_popup_menu (GtkMenu *menu, GtkWidget *widget, GdkEventButton *event)
         }
 
         gtk_menu_popup (menu, NULL, NULL, NULL, NULL, button, event_time);
+#endif
 }
 
 G_MODULE_EXPORT
diff --git a/src/network-light/gui.c b/src/network-light/gui.c
index b143ec5..bb5cc5d 100644
--- a/src/network-light/gui.c
+++ b/src/network-light/gui.c
@@ -162,6 +162,9 @@ on_main_window_right_clicked (GdkEventButton *event)
 
         prepare_popup ();
 
+#if GTK_CHECK_VERSION(3,22,0)
+        gtk_menu_popup_at_pointer (GTK_MENU (popup), (GdkEvent *)event);
+#else
         gtk_menu_popup (GTK_MENU (popup),
                         NULL,
                         NULL,
@@ -169,6 +172,7 @@ on_main_window_right_clicked (GdkEventButton *event)
                         NULL,
                         event->button,
                         event->time);
+#endif
 }
 
 G_MODULE_EXPORT
diff --git a/src/universal-cp/details-treeview.c b/src/universal-cp/details-treeview.c
index ae5507d..9ce543d 100644
--- a/src/universal-cp/details-treeview.c
+++ b/src/universal-cp/details-treeview.c
@@ -74,6 +74,9 @@ on_details_treeview_button_release (GtkWidget      *widget,
                       get_selected_row (NULL),
                       NULL);
 
+#if GTK_CHECK_VERSION(3,22,0)
+        gtk_menu_popup_at_pointer (GTK_MENU (popup), (GdkEvent *)event);
+#else
         gtk_menu_popup (GTK_MENU (popup),
                         NULL,
                         NULL,
@@ -81,6 +84,7 @@ on_details_treeview_button_release (GtkWidget      *widget,
                         NULL,
                         event->button,
                         event->time);
+#endif
         return TRUE;
 }
 
diff --git a/src/universal-cp/device-treeview.c b/src/universal-cp/device-treeview.c
index 7893109..79ec04b 100644
--- a/src/universal-cp/device-treeview.c
+++ b/src/universal-cp/device-treeview.c
@@ -210,6 +210,9 @@ on_device_treeview_button_release (GtkWidget      *widget,
 
         setup_device_popup (popup);
 
+#if GTK_CHECK_VERSION(3,22,0)
+        gtk_menu_popup_at_pointer (GTK_MENU (popup), (GdkEvent *)event);
+#else
         gtk_menu_popup (GTK_MENU (popup),
                         NULL,
                         NULL,
@@ -217,6 +220,7 @@ on_device_treeview_button_release (GtkWidget      *widget,
                         NULL,
                         event->button,
                         event->time);
+#endif
         return TRUE;
 }
 
diff --git a/src/universal-cp/event-treeview.c b/src/universal-cp/event-treeview.c
index d41842e..9542b3c 100644
--- a/src/universal-cp/event-treeview.c
+++ b/src/universal-cp/event-treeview.c
@@ -152,6 +152,9 @@ on_event_treeview_button_release (GtkWidget      *widget,
 
         setup_event_popup (popup);
 
+#if GTK_CHECK_VERSION(3,22,0)
+        gtk_menu_popup_at_pointer (GTK_MENU (popup), (GdkEvent *)event);
+#else
         gtk_menu_popup (GTK_MENU (popup),
                         NULL,
                         NULL,
@@ -159,6 +162,7 @@ on_event_treeview_button_release (GtkWidget      *widget,
                         NULL,
                         event->button,
                         event->time);
+#endif
         return TRUE;
 }
 
diff --git a/src/universal-cp/gui.c b/src/universal-cp/gui.c
index 9ddb9ab..d56ef9d 100644
--- a/src/universal-cp/gui.c
+++ b/src/universal-cp/gui.c
@@ -108,6 +108,7 @@ init_ui (gint   *argc,
         gint       window_width, window_height;
         gint       position;
         GError    *error = NULL;
+        double     w,h;
 
         gtk_init (argc, argv);
 
@@ -139,12 +140,31 @@ init_ui (gint   *argc,
         g_assert (vpaned != NULL);
 
         /* 80% of the screen but don't get bigger than 1000x800 */
-        window_width = CLAMP ((gdk_screen_width () * 80 / 100), 10, 1000);
-        window_height = CLAMP ((gdk_screen_height () * 80 / 100), 10, 800);
+        /* FIXME: Replace with proper functions */
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+        w = gdk_screen_width () * 0.8;
+        h = gdk_screen_height () * 0.8;
+        G_GNUC_END_IGNORE_DEPRECATIONS
+
+        /* Keep 5/4 aspect */
+        if (w/h > 1.25) {
+                h = w / 1.25;
+        } else {
+                w = h * 1.25;
+        }
+
+        window_width = CLAMP ((int) w, 10, 1000);
+        window_height = CLAMP ((int) h, 10, 800);
+
         gtk_window_set_default_size (GTK_WINDOW (main_window),
                                      window_width,
                                      window_height);
 
+        gtk_window_resize (GTK_WINDOW (main_window),
+                                     window_width,
+                                     window_height);
+
+
         icon_pixbuf = load_pixbuf_file (ICON_FILE);
         if (icon_pixbuf == NULL) {
                 return FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]