[gnome-panel] wncklet: use default screen



commit 10be771925bff20d6f79d71700b7be6a43ef9ccd
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Oct 31 22:01:52 2016 +0200

    wncklet: use default screen

 applets/wncklet/showdesktop.c        |    6 ++----
 applets/wncklet/window-list.c        |   12 +-----------
 applets/wncklet/wncklet.c            |   27 ++++-----------------------
 applets/wncklet/wncklet.h            |   14 ++++----------
 applets/wncklet/workspace-switcher.c |    3 +--
 5 files changed, 12 insertions(+), 50 deletions(-)
---
diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c
index 5c0ac6c..63544f6 100644
--- a/applets/wncklet/showdesktop.c
+++ b/applets/wncklet/showdesktop.c
@@ -382,7 +382,6 @@ show_desktop_applet_realized (PanelApplet *applet,
                              gpointer     data)
 {
        ShowDesktopData *sdd;
-       GdkScreen       *screen;
        
        sdd = (ShowDesktopData *) data;
 
@@ -396,8 +395,7 @@ show_desktop_applet_realized (PanelApplet *applet,
                                                      theme_changed_callback,
                                                      sdd);
 
-       screen = gtk_widget_get_screen (sdd->applet);
-       sdd->wnck_screen = wnck_screen_get (gdk_x11_screen_get_screen_number (screen));
+       sdd->wnck_screen = wnck_screen_get_default ();
 
        if (sdd->wnck_screen != NULL)
                wncklet_connect_while_alive (sdd->wnck_screen,
@@ -410,7 +408,7 @@ show_desktop_applet_realized (PanelApplet *applet,
 
         show_desktop_changed_callback (sdd->wnck_screen, sdd);
 
-       sdd->icon_theme = gtk_icon_theme_get_for_screen (screen);
+       sdd->icon_theme = gtk_icon_theme_get_default ();
        wncklet_connect_while_alive (sdd->icon_theme, "changed",
                                     G_CALLBACK (theme_changed_callback),
                                     sdd,
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index d51cd8c..d716ea6 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -86,13 +86,6 @@ response_cb (GtkWidget    *widget,
 }
 
 static void
-applet_realized (PanelApplet  *applet,
-                TasklistData *tasklist)
-{
-       tasklist->icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (tasklist->applet));
-}
-
-static void
 applet_change_orient (PanelApplet       *applet,
                      PanelAppletOrient  orient,
                      TasklistData      *tasklist)
@@ -540,6 +533,7 @@ window_list_applet_fill (PanelApplet *applet)
        }
 
        tasklist->tasklist = wnck_tasklist_new ();
+       tasklist->icon_theme = gtk_icon_theme_get_default ();
 
        wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), tasklist->orientation);
        wnck_tasklist_set_icon_loader (WNCK_TASKLIST (tasklist->tasklist),
@@ -557,10 +551,6 @@ window_list_applet_fill (PanelApplet *applet)
        gtk_container_add (GTK_CONTAINER (tasklist->applet), tasklist->tasklist);
 
        g_signal_connect (G_OBJECT (tasklist->applet),
-                         "realize",
-                         G_CALLBACK (applet_realized),
-                         tasklist);
-       g_signal_connect (G_OBJECT (tasklist->applet),
                          "change_orient",
                          G_CALLBACK (applet_change_orient),
                          tasklist);
diff --git a/applets/wncklet/wncklet.c b/applets/wncklet/wncklet.c
index fafb553..1a47f6e 100644
--- a/applets/wncklet/wncklet.c
+++ b/applets/wncklet/wncklet.c
@@ -1,5 +1,4 @@
-/* wncklet.c: A collection of window navigation applets
- *
+/*
  * Copyright (C) 2003 Sun Microsystems, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -19,17 +18,12 @@
  *      Mark McLoughlin <mark skynet ie>
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <panel-applet.h>
+#include "config.h"
 
-#include <glib/gi18n.h>
-#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #include <libwnck/libwnck.h>
+#include <panel-applet.h>
+#include <string.h>
 
 #include "wncklet.h"
 #include "window-menu.h"
@@ -37,19 +31,6 @@
 #include "window-list.h"
 #include "showdesktop.h"
 
-WnckScreen *
-wncklet_get_screen (GtkWidget *applet)
-{
-       int screen_num;
-
-       if (!gtk_widget_has_screen (applet))
-               return wnck_screen_get_default ();
-
-       screen_num = gdk_x11_screen_get_screen_number (gtk_widget_get_screen (applet));
-
-       return wnck_screen_get (screen_num);
-}
-
 void
 wncklet_connect_while_alive (gpointer    object,
                             const char *signal,
diff --git a/applets/wncklet/wncklet.h b/applets/wncklet/wncklet.h
index e2f4c68..261db80 100644
--- a/applets/wncklet/wncklet.h
+++ b/applets/wncklet/wncklet.h
@@ -1,5 +1,4 @@
-/* wncklet.h
- *
+/*
  * Copyright (C) 2003  Wipro Technologies
  *
  * This library is free software; you can redistribute it and/or
@@ -16,24 +15,19 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Authors: Arvind Samptur <arvind samptur wipro com>
- *
  */
 
-#ifndef __WNCKLET_H__
-#define __WNCKLET_H__
-
-#include <libwnck/libwnck.h>
+#ifndef WNCKLET_H
+#define WNCKLET_H
 
 #include <glib.h>
 #include <gtk/gtk.h>
-#include <panel-applet.h>
+#include <libwnck/libwnck.h>
 
 #define WNCKLET_RESOURCE_PATH "/org/gnome/panel/applet/wncklet/"
 
 G_BEGIN_DECLS
 
-WnckScreen *wncklet_get_screen          (GtkWidget *applet);
-       
 void        wncklet_connect_while_alive (gpointer    object,
                                         const char *signal,
                                         GCallback   func,
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index 67e7975..d61a1bb 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -151,7 +151,7 @@ static void
 applet_realized (PanelApplet *applet,
                 PagerData   *pager)
 {
-       pager->screen = wncklet_get_screen (GTK_WIDGET (applet));
+       pager->screen = wnck_screen_get_default ();
 
        window_manager_changed (pager->screen, pager);
        wncklet_connect_while_alive (pager->screen, "window_manager_changed",
@@ -168,7 +168,6 @@ applet_unrealized (PanelApplet *applet,
        pager->wm = PAGER_WM_UNKNOWN;
 }
 
-
 static void
 applet_change_orient (PanelApplet       *applet,
                      PanelAppletOrient  orient,


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