Browse Source

* Switch to libwnck.

(Old svn revision: 26151)
upstream/xfce4-panel-4.10.1
Nick Schermer 15 years ago
parent
commit
19e04e895d
  1. 3
      configure.in.in
  2. 5
      plugins/iconbox/Makefile.am
  3. 119
      plugins/iconbox/iconbox.c
  4. 9
      plugins/pager/Makefile.am
  5. 81
      plugins/pager/pager.c
  6. 183
      plugins/pager/xfce-pager.c
  7. 51
      plugins/pager/xfce-pager.h
  8. 5
      plugins/showdesktop/Makefile.am
  9. 29
      plugins/showdesktop/showdesktop.c
  10. 5
      plugins/tasklist/Makefile.am
  11. 85
      plugins/tasklist/tasklist-dialogs.c
  12. 2
      plugins/tasklist/tasklist-dialogs.h
  13. 537
      plugins/tasklist/tasklist.c
  14. 20
      plugins/tasklist/tasklist.h
  15. 3
      plugins/windowlist/Makefile.am
  16. 246
      plugins/windowlist/windowlist.c
  17. 3
      plugins/windowlist/windowlist.h

3
configure.in.in

@ -14,7 +14,7 @@ m4_define([libxfce4panel_verinfo], [2:2:1])
m4_define([xfce4_panel_version_major], [4])
m4_define([xfce4_panel_version_minor], [5])
m4_define([xfce4_panel_version_micro], [0])
m4_define([xfce4_panel_version_nano], [2]) dnl leave this empty to have no nano version
m4_define([xfce4_panel_version_nano], [3]) dnl leave this empty to have no nano version
m4_define([xfce4_panel_version_build], [r@REVISION@])
m4_define([xfce4_panel_version_tag], [svn])
m4_define([xfce4_panel_version], [xfce4_panel_version_major().xfce4_panel_version_minor().xfce4_panel_version_micro()ifelse(xfce4_panel_version_nano(), [], [], [.xfce4_panel_version_nano()])ifelse(xfce4_panel_version_tag(), [svn], [xfce4_panel_version_tag()-xfce4_panel_version_build()], [xfce4_panel_version_tag()])])
@ -113,6 +113,7 @@ XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.8.0])
XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.4.0])
XDT_CHECK_PACKAGE([LIBEXO], [exo-0.3], [0.3.1.11])
XDT_CHECK_PACKAGE([CAIRO], [cairo], [1.0.0])
XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-1.0], [2.12])
dnl ***********************************
dnl *** Check for optional packages ***

5
plugins/iconbox/Makefile.am

@ -4,6 +4,7 @@ INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"libiconbox\" \
-DLOCALEDIR=\"$(localedir)\" \
-DWNCK_I_KNOW_THIS_IS_UNSTABLE \
$(PLATFORM_CPPFLAGS)
plugindir = \
@ -19,6 +20,7 @@ libiconbox_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(LIBWNCK_CFLAGS) \
$(PLATFORM_CFLAGS)
libiconbox_la_LDFLAGS = \
@ -35,7 +37,8 @@ libiconbox_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCEGUI4_LIBS)
$(LIBXFCEGUI4_LIBS) \
$(LIBWNCK_LIBS)
libiconbox_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la

119
plugins/iconbox/iconbox.c

@ -24,9 +24,10 @@
#include <math.h>
#include <gtk/gtk.h>
#include <libwnck/libwnck.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfcegui4/libxfcegui4.h>
#include <libxfcegui4/netk-window-action-menu.h>
#include <libwnck/window-action-menu.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4panel/xfce-panel-convenience.h>
#include <libxfce4panel/xfce-hvbox.h>
@ -39,7 +40,7 @@ typedef struct
{
XfcePanelPlugin *plugin;
NetkScreen *netk_screen;
WnckScreen *wnck_screen;
int connections[N_ICONBOX_CONNECTIONS];
int screen_changed_id;
GtkWidget *box;
@ -60,7 +61,7 @@ typedef struct
{
Iconbox *ib;
NetkWindow *window;
WnckWindow *window;
int connections[N_ICON_CONNECTIONS];
GdkPixbuf *pb;
@ -85,19 +86,19 @@ static void iconbox_construct (XfcePanelPlugin *plugin);
/* icons */
static void
update_visibility (Icon *icon, NetkWorkspace *optional_active_ws)
update_visibility (Icon *icon, WnckWorkspace *optional_active_ws)
{
NetkWorkspace *ws;
WnckWorkspace *ws;
gdk_flush ();
if (netk_window_is_skip_tasklist (icon->window))
if (wnck_window_is_skip_tasklist (icon->window))
{
gtk_widget_hide (icon->button);
return;
}
if (icon->ib->only_hidden && !netk_window_is_minimized (icon->window))
if (icon->ib->only_hidden && !wnck_window_is_minimized (icon->window))
{
gtk_widget_hide (icon->button);
return;
@ -109,14 +110,14 @@ update_visibility (Icon *icon, NetkWorkspace *optional_active_ws)
}
else
{
ws = netk_screen_get_active_workspace
(netk_window_get_screen (icon->window));
ws = wnck_screen_get_active_workspace
(wnck_window_get_screen (icon->window));
}
if (icon->ib->all_workspaces
|| netk_window_is_sticky (icon->window)
|| ws == netk_window_get_workspace (icon->window)
|| netk_window_or_transient_demands_attention (icon->window))
|| wnck_window_is_sticky (icon->window)
|| ws == wnck_window_get_workspace (icon->window)
|| wnck_window_or_transient_needs_attention (icon->window))
{
gtk_widget_show (icon->button);
}
@ -133,11 +134,11 @@ icon_update_image (Icon *icon)
g_return_if_fail (GDK_IS_PIXBUF (icon->pb));
if (netk_window_is_minimized (icon->window))
if (wnck_window_is_minimized (icon->window))
{
if (!icon->was_minimized)
{
/* copied from netk-tasklist.c: dimm_icon */
/* copied from wnck-tasklist.c: dimm_icon */
int x, y, w, h, pixel_stride, row_stride;
guchar *row, *pixels;
@ -264,24 +265,24 @@ icon_button_pressed (GtkWidget *button, GdkEventButton *ev, gpointer data)
if (ev->button == 1)
{
if (netk_window_is_active (icon->window))
if (wnck_window_is_active (icon->window))
{
netk_window_minimize (icon->window);
wnck_window_minimize (icon->window);
}
else
{
NetkScreen *scr;
NetkWorkspace *aws, *ws;
WnckScreen *scr;
WnckWorkspace *aws, *ws;
scr = netk_window_get_screen (icon->window);
aws = netk_screen_get_active_workspace (scr);
ws = netk_window_get_workspace (icon->window);
scr = wnck_window_get_screen (icon->window);
aws = wnck_screen_get_active_workspace (scr);
ws = wnck_window_get_workspace (icon->window);
if (aws != ws)
{
netk_workspace_activate (ws);
wnck_workspace_activate (ws, ev->time);
}
netk_window_activate (icon->window);
wnck_window_activate (icon->window, ev->time);
}
return TRUE;
@ -290,7 +291,7 @@ icon_button_pressed (GtkWidget *button, GdkEventButton *ev, gpointer data)
{
GtkWidget *action_menu;
action_menu = netk_create_window_action_menu(icon->window);
action_menu = wnck_create_window_action_menu(icon->window);
g_signal_connect(G_OBJECT(action_menu), "selection-done",
G_CALLBACK(gtk_widget_destroy), NULL);
@ -305,24 +306,24 @@ icon_button_pressed (GtkWidget *button, GdkEventButton *ev, gpointer data)
}
static void
icon_name_changed (NetkWindow *window, gpointer data)
icon_name_changed (WnckWindow *window, gpointer data)
{
Icon *icon = (Icon *)data;
gtk_tooltips_set_tip (icon->ib->icon_tooltips, icon->button,
netk_window_get_name (window), NULL);
wnck_window_get_name (window), NULL);
}
static void
icon_state_changed (NetkWindow *window, NetkWindowState changed_mask,
NetkWindowState new_state, gpointer data)
icon_state_changed (WnckWindow *window, WnckWindowState changed_mask,
WnckWindowState new_state, gpointer data)
{
Icon *icon = (Icon *)data;
if (changed_mask & NETK_WINDOW_STATE_DEMANDS_ATTENTION
|| changed_mask & NETK_WINDOW_STATE_URGENT)
if (changed_mask & WNCK_WINDOW_STATE_DEMANDS_ATTENTION
|| changed_mask & WNCK_WINDOW_STATE_URGENT)
{
if (netk_window_or_transient_demands_attention (window))
if (wnck_window_or_transient_needs_attention (window))
{
queue_urgent_timeout (icon);
}
@ -332,8 +333,8 @@ icon_state_changed (NetkWindow *window, NetkWindowState changed_mask,
}
}
if (changed_mask & NETK_WINDOW_STATE_MINIMIZED
|| changed_mask & NETK_WINDOW_STATE_SKIP_TASKLIST)
if (changed_mask & WNCK_WINDOW_STATE_MINIMIZED
|| changed_mask & WNCK_WINDOW_STATE_SKIP_TASKLIST)
{
update_visibility (icon, NULL);
@ -342,7 +343,7 @@ icon_state_changed (NetkWindow *window, NetkWindowState changed_mask,
}
static void
icon_workspace_changed (NetkWindow *window, gpointer data)
icon_workspace_changed (WnckWindow *window, gpointer data)
{
Icon *icon = (Icon *)data;
@ -350,20 +351,20 @@ icon_workspace_changed (NetkWindow *window, gpointer data)
}
static void
icon_icon_changed (NetkWindow *window, gpointer data)
icon_icon_changed (WnckWindow *window, gpointer data)
{
Icon *icon = (Icon *)data;
if (icon->pb)
g_object_unref (G_OBJECT (icon->pb));
icon->pb = netk_window_get_icon (icon->window);
icon->pb = wnck_window_get_icon (icon->window);
if (icon->pb)
g_object_ref (G_OBJECT (icon->pb));
/* make sure the icon is actually updated */
icon->was_minimized = !netk_window_is_minimized (icon->window);
icon->was_minimized = !wnck_window_is_minimized (icon->window);
icon_update_image (icon);
}
@ -389,7 +390,7 @@ icon_destroy (Icon *icon)
}
static Icon *
icon_new (NetkWindow *window, Iconbox *ib)
icon_new (WnckWindow *window, Iconbox *ib)
{
Icon *icon = panel_slice_new0 (Icon);
int i = 0;
@ -407,7 +408,7 @@ icon_new (NetkWindow *window, Iconbox *ib)
gtk_widget_show (icon->image);
gtk_container_add (GTK_CONTAINER (icon->button), icon->image);
icon->pb = netk_window_get_icon (window);
icon->pb = wnck_window_get_icon (window);
if (icon->pb)
{
xfce_scaled_image_set_from_pixbuf (XFCE_SCALED_IMAGE (icon->image),
@ -433,7 +434,7 @@ icon_new (NetkWindow *window, Iconbox *ib)
g_assert (i == N_ICON_CONNECTIONS);
if (netk_window_is_skip_tasklist (window))
if (wnck_window_is_skip_tasklist (window))
{
return icon;
}
@ -441,7 +442,7 @@ icon_new (NetkWindow *window, Iconbox *ib)
icon_update_image (icon);
gtk_tooltips_set_tip (ib->icon_tooltips, icon->button,
netk_window_get_name (window), NULL);
wnck_window_get_name (window), NULL);
update_visibility (icon, NULL);
@ -450,11 +451,11 @@ icon_new (NetkWindow *window, Iconbox *ib)
/* iconlist */
static void
iconbox_active_window_changed (NetkScreen *screen, gpointer data)
iconbox_active_window_changed (WnckScreen *screen, WnckScreen *previous, gpointer data)
{
Iconbox *ib = (Iconbox *)data;
GSList *l;
NetkWindow *window = netk_screen_get_active_window (screen);
WnckWindow *window = wnck_screen_get_active_window (screen);
for (l = ib->iconlist; l != NULL; l = l->next)
{
@ -466,11 +467,11 @@ iconbox_active_window_changed (NetkScreen *screen, gpointer data)
}
static void
iconbox_active_workspace_changed (NetkScreen *screen, gpointer data)
iconbox_active_workspace_changed (WnckScreen *screen, WnckWorkspace *previous_workspace, gpointer data)
{
Iconbox *ib = (Iconbox *)data;
GSList *l;
NetkWorkspace *ws = netk_screen_get_active_workspace (screen);
WnckWorkspace *ws = wnck_screen_get_active_workspace (screen);
for (l = ib->iconlist; l != NULL; l = l->next)
{
@ -481,7 +482,7 @@ iconbox_active_workspace_changed (NetkScreen *screen, gpointer data)
}
static void
iconbox_window_opened (NetkScreen *screen, NetkWindow *window, gpointer data)
iconbox_window_opened (WnckScreen *screen, WnckWindow *window, gpointer data)
{
Iconbox *ib = (Iconbox *)data;
Icon *icon;
@ -492,14 +493,14 @@ iconbox_window_opened (NetkScreen *screen, NetkWindow *window, gpointer data)
gtk_box_pack_start (GTK_BOX (ib->iconbox), icon->button, FALSE, FALSE, 0);
if (netk_window_or_transient_demands_attention (window))
if (wnck_window_or_transient_needs_attention (window))
{
queue_urgent_timeout (icon);
}
}
static void
iconbox_window_closed (NetkScreen *screen, NetkWindow *window, gpointer data)
iconbox_window_closed (WnckScreen *screen, WnckWindow *window, gpointer data)
{
Iconbox *ib = (Iconbox *)data;
GSList *l;
@ -527,40 +528,40 @@ iconbox_init_icons (Iconbox * ib)
int i = 0;
GList *windows, *l;
netk_screen_force_update (ib->netk_screen);
wnck_screen_force_update (ib->wnck_screen);
ib->connections[i++] =
g_signal_connect (ib->netk_screen, "active_window_changed",
g_signal_connect (ib->wnck_screen, "active_window_changed",
G_CALLBACK (iconbox_active_window_changed),
ib);
ib->connections[i++] =
g_signal_connect (ib->netk_screen, "active_workspace_changed",
g_signal_connect (ib->wnck_screen, "active_workspace_changed",
G_CALLBACK (iconbox_active_workspace_changed),
ib);
ib->connections[i++] =
g_signal_connect (ib->netk_screen, "window_opened",
g_signal_connect (ib->wnck_screen, "window_opened",
G_CALLBACK (iconbox_window_opened),
ib);
ib->connections[i++] =
g_signal_connect (ib->netk_screen, "window_closed",
g_signal_connect (ib->wnck_screen, "window_closed",
G_CALLBACK (iconbox_window_closed),
ib);
g_assert (i == N_ICONBOX_CONNECTIONS);
windows = netk_screen_get_windows (ib->netk_screen);
windows = wnck_screen_get_windows (ib->wnck_screen);
for (l = windows; l != NULL; l = l->next)
{
NetkWindow *w = l->data;
WnckWindow *w = l->data;
iconbox_window_opened (ib->netk_screen, w, ib);
iconbox_window_opened (ib->wnck_screen, w, ib);
}
iconbox_active_window_changed (ib->netk_screen, ib);
iconbox_active_window_changed (ib->wnck_screen, NULL, ib);
}
/* cleanup */
@ -573,7 +574,7 @@ cleanup_icons (Iconbox *ib)
for (i = 0; i < N_ICONBOX_CONNECTIONS; i++)
{
if (ib->connections[i])
g_signal_handler_disconnect (ib->netk_screen, ib->connections[i]);
g_signal_handler_disconnect (ib->wnck_screen, ib->connections[i]);
ib->connections[i] = 0;
}
@ -766,7 +767,7 @@ iconbox_screen_changed (GtkWidget *plugin, GdkScreen *screen, Iconbox *ib)
(GtkCallback) gtk_widget_destroy, NULL);
cleanup_icons (ib);
ib->netk_screen = netk_screen_get (gdk_screen_get_number (screen));
ib->wnck_screen = wnck_screen_get (gdk_screen_get_number (screen));
iconbox_init_icons (ib);
}

9
plugins/pager/Makefile.am

@ -4,6 +4,7 @@ INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"libpager\" \
-DLOCALEDIR=\"$(localedir)\" \
-DWNCK_I_KNOW_THIS_IS_UNSTABLE \
$(PLATFORM_CPPFLAGS)
plugindir = \
@ -13,12 +14,15 @@ plugin_LTLIBRARIES = \
libpager.la
libpager_la_SOURCES = \
pager.c
pager.c \
xfce-pager.c \
xfce-pager.h
libpager_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(LIBWNCK_CFLAGS) \
$(PLATFORM_CFLAGS)
libpager_la_LDFLAGS = \
@ -35,7 +39,8 @@ libpager_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCEGUI4_LIBS)
$(LIBXFCEGUI4_LIBS) \
$(LIBWNCK_LIBS)
libpager_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la

81
plugins/pager/pager.c

@ -26,25 +26,29 @@
#include <gtk/gtk.h>
#include <libxfce4util/libxfce4util.h>
#include <libwnck/libwnck.h>
#include <libxfcegui4/libxfcegui4.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include "xfce-pager.h"
typedef struct
{
XfcePanelPlugin *plugin;
NetkScreen *screen;
GdkScreen *gdk_screen;
GtkWidget *pager;
WnckScreen *screen;
GdkScreen *gdk_screen;
GtkWidget *pager;
int ws_created_id;
int ws_destroyed_id;
int screen_changed_id;
int screen_size_changed_id;
gint ws_created_id;
gint ws_destroyed_id;
gint screen_changed_id;
gint screen_size_changed_id;
int rows;
guint scrolling:1;
gint rows;
guint scrolling : 1;
guint show_names : 1;
}
Pager;
@ -69,7 +73,7 @@ pager_orientation_changed (XfcePanelPlugin *plugin,
GtkOrientation orientation,
Pager *pager)
{
netk_pager_set_orientation (NETK_PAGER (pager->pager), orientation);
wnck_pager_set_orientation (WNCK_PAGER (pager->pager), orientation);
}
static gboolean
@ -128,6 +132,7 @@ pager_read_rc_file (XfcePanelPlugin *plugin, Pager *pager)
XfceRc *rc;
int rows = 1;
gboolean scrolling = TRUE;
gboolean show_names = FALSE;
if ((file = xfce_panel_plugin_lookup_rc_file (plugin)) != NULL)
{
@ -138,11 +143,13 @@ pager_read_rc_file (XfcePanelPlugin *plugin, Pager *pager)
{
rows = xfce_rc_read_int_entry (rc, "rows", 1);
scrolling = xfce_rc_read_bool_entry (rc, "scrolling", TRUE);
show_names = xfce_rc_read_bool_entry (rc, "show-names", FALSE);
}
}
pager->rows = rows;
pager->scrolling = scrolling;
pager->show_names = show_names;
}
static void
@ -164,12 +171,14 @@ pager_write_rc_file (XfcePanelPlugin *plugin, Pager *pager)
xfce_rc_write_bool_entry (rc, "scrolling", pager->scrolling);
xfce_rc_write_bool_entry (rc, "show-names", pager->show_names);
xfce_rc_close (rc);
}
/* create widgets and connect to signals */
static void
pager_n_workspaces_changed (NetkScreen * screen, NetkWorkspace * ws,
pager_n_workspaces_changed (WnckScreen * screen, WnckWorkspace * ws,
Pager * pager)
{
pager_set_size (pager->plugin,
@ -203,9 +212,9 @@ pager_screen_changed (GtkWidget *plugin, GdkScreen *screen, Pager *pager)
}
pager->gdk_screen = screen;
pager->screen = netk_screen_get (gdk_screen_get_number (screen));
pager->screen = wnck_screen_get (gdk_screen_get_number (screen));
netk_pager_set_screen (NETK_PAGER (pager->pager), pager->screen);
wnck_pager_set_screen (WNCK_PAGER (pager->pager), pager->screen);
pager->ws_created_id =
g_signal_connect (pager->screen, "workspace-created",
@ -254,15 +263,15 @@ pager_construct (XfcePanelPlugin *plugin)
pager->gdk_screen = screen = gtk_widget_get_screen (GTK_WIDGET (plugin));
screen_idx = gdk_screen_get_number (screen);
pager->screen = netk_screen_get (screen_idx);
pager->screen = wnck_screen_get (screen_idx);
pager_read_rc_file (plugin, pager);
pager->pager = netk_pager_new (pager->screen);
netk_pager_set_orientation (NETK_PAGER (pager->pager),
pager->pager = xfce_pager_new (pager->screen);
wnck_pager_set_orientation (WNCK_PAGER (pager->pager),
xfce_panel_plugin_get_orientation (plugin));
netk_pager_set_n_rows (NETK_PAGER (pager->pager), pager->rows);
netk_pager_set_workspace_scrolling (NETK_PAGER (pager->pager), pager->scrolling);
wnck_pager_set_n_rows (WNCK_PAGER (pager->pager), pager->rows);
xfce_pager_set_workspace_scrolling (XFCE_PAGER (pager->pager), pager->scrolling);
gtk_widget_show (pager->pager);
gtk_container_add (GTK_CONTAINER (plugin), pager->pager);
@ -292,13 +301,13 @@ pager_construct (XfcePanelPlugin *plugin)
static void
rows_changed (GtkSpinButton * spin, Pager * pager)
{
int rows = gtk_spin_button_get_value_as_int (spin);
gint rows = gtk_spin_button_get_value_as_int (spin);
if (rows != pager->rows)
{
pager->rows = rows;
netk_pager_set_n_rows (NETK_PAGER (pager->pager), pager->rows);
wnck_pager_set_n_rows (WNCK_PAGER (pager->pager), pager->rows);
}
}
@ -311,7 +320,21 @@ workspace_scrolling_toggled (GtkWidget *button, Pager *pager)
{
pager->scrolling = scrolling;
netk_pager_set_workspace_scrolling (NETK_PAGER (pager->pager), scrolling);
xfce_pager_set_workspace_scrolling (XFCE_PAGER (pager->pager), scrolling);
}
}
static void
workspace_show_names_toggled (GtkWidget *button, Pager *pager)
{
gboolean show_names = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
if (pager->show_names != show_names)
{
pager->show_names = show_names;
wnck_pager_set_display_mode (WNCK_PAGER (pager->pager),
show_names ? WNCK_PAGER_DISPLAY_NAME : WNCK_PAGER_DISPLAY_CONTENT);
}
}
@ -328,8 +351,8 @@ pager_dialog_response (GtkWidget *dlg, int reponse, Pager *pager)
static void
pager_properties_dialog (XfcePanelPlugin *plugin, Pager *pager)
{
GtkWidget *dlg, *vbox, *hbox, *label, *spin, *scrolling;
int max;
GtkWidget *dlg, *vbox, *hbox, *label, *spin, *scrolling, *show_names;
gint max;
xfce_panel_plugin_block_menu (plugin);
@ -373,7 +396,7 @@ pager_properties_dialog (XfcePanelPlugin *plugin, Pager *pager)
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
max = netk_screen_get_workspace_count (pager->screen);
max = wnck_screen_get_workspace_count (pager->screen);
if (max > 1)
{
@ -388,7 +411,7 @@ pager_properties_dialog (XfcePanelPlugin *plugin, Pager *pager)
}
else
{
GtkWidget *label = gtk_label_new ("1");
label = gtk_label_new ("1");
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@ -402,6 +425,14 @@ pager_properties_dialog (XfcePanelPlugin *plugin, Pager *pager)
g_signal_connect (scrolling, "toggled",
G_CALLBACK (workspace_scrolling_toggled), pager);
show_names = gtk_check_button_new_with_mnemonic (_("Show workspace names"));
gtk_widget_show (show_names);
gtk_box_pack_start (GTK_BOX (vbox), show_names, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_names), pager->show_names);
g_signal_connect (show_names, "toggled",
G_CALLBACK (workspace_show_names_toggled), pager);
gtk_widget_show (dlg);
}

183
plugins/pager/xfce-pager.c

@ -0,0 +1,183 @@
/* vim: set expandtab ts=8 sw=4: */
/* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <libwnck/libwnck.h>
#include <libxfce4panel/xfce-panel-macros.h>
#include "xfce-pager.h"
#define XFCE_PAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFCE_TYPE_PAGER, XfcePagerPrivate))
struct _XfcePagerPrivate
{
WnckScreen *screen;
guint workspace_scrolling : 1;
};
static void xfce_pager_init (XfcePager *pager);
static void xfce_pager_class_init (XfcePagerClass *pager);
static gboolean xfce_pager_scroll_event (GtkWidget *widget,
GdkEventScroll *event);
static WnckScreen *xfce_pager_get_screen (XfcePager *pager);
GType
xfce_pager_get_type ()
{
static GType xfce_pager_type = 0;
if (!xfce_pager_type)
{
static const GTypeInfo xfce_pager_info =
{
sizeof (XfcePagerClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) xfce_pager_class_init,
(GClassFinalizeFunc) NULL,
NULL,
sizeof (XfcePager),
0,
(GInstanceInitFunc) xfce_pager_init,
NULL
};
xfce_pager_type = g_type_register_static (WNCK_TYPE_PAGER, I_("XfcePager"), &xfce_pager_info, 0);
}
return xfce_pager_type;
}
static void
xfce_pager_class_init (XfcePagerClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
g_type_class_add_private (klass, sizeof (XfcePagerPrivate));
widget_class->scroll_event = xfce_pager_scroll_event;
}
static void
xfce_pager_init(XfcePager *pager)
{
pager->priv = XFCE_PAGER_GET_PRIVATE (pager);
}
GtkWidget *
xfce_pager_new (WnckScreen *screen)
{
GtkWidget *pager = g_object_new (XFCE_TYPE_PAGER, NULL);
XFCE_PAGER (pager)->priv->screen = screen;
wnck_pager_set_screen (WNCK_PAGER (pager), screen);
return pager;
}
void
xfce_pager_set_workspace_scrolling (XfcePager *pager,
gboolean scrolling)
{
pager->priv->workspace_scrolling = scrolling;
}
static gboolean
xfce_pager_scroll_event (GtkWidget *widget,
GdkEventScroll *event)
{
XfcePager *pager;
gint n, active;
WnckWorkspace *ws = NULL;
WnckScreen *screen;
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (widget != NULL, FALSE);
pager = XFCE_PAGER (widget);
if (!pager->priv->workspace_scrolling)
return FALSE;
screen = xfce_pager_get_screen (pager);
n = wnck_screen_get_workspace_count (screen);
active = wnck_workspace_get_number (wnck_screen_get_active_workspace(screen));
switch (event->direction)
{
case GDK_SCROLL_UP:
case GDK_SCROLL_LEFT:
if (active > 0)
{
ws = wnck_screen_get_workspace (screen, active - 1);
}
else
{
ws = wnck_screen_get_workspace (screen, n - 1);
}
wnck_workspace_activate (ws, 0);
break;
case GDK_SCROLL_DOWN:
case GDK_SCROLL_RIGHT:
if (active < n - 1)
{
ws = wnck_screen_get_workspace (screen, active + 1);
}
else
{
ws = wnck_screen_get_workspace (screen, 0);
}
wnck_workspace_activate (ws, 0);
break;
default:
break;
}
return TRUE;
}
static WnckScreen *
xfce_pager_get_screen (XfcePager *pager)
{
return pager->priv->screen;
}

51
plugins/pager/xfce-pager.h

@ -0,0 +1,51 @@
/* vim: set expandtab ts=8 sw=4: */
/* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __XFCE_PAGER_H__
#define __XFCE_PAGER_H__
#define XFCE_TYPE_PAGER xfce_pager_get_type()
#define XFCE_PAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_PAGER, XfcePager))
#define XFCE_IS_PAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_PAGER))
#define XFCE_PAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_PAGER, XfcePagerClass))
#define XFCE_IS_PAGER_CLASS(klass) ( G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_PAGER))
typedef struct _XfcePagerPrivate XfcePagerPrivate;
typedef struct _XfcePager XfcePager;
typedef struct _XfcePagerClass XfcePagerClass;
struct _XfcePager
{
WnckPager __parent__;
XfcePagerPrivate *priv;
};
struct _XfcePagerClass
{
WnckPagerClass __parent__;
};
GType xfce_pager_get_type();
GtkWidget *xfce_pager_new (WnckScreen *screen);
void xfce_pager_set_workspace_scrolling (XfcePager *pager,
gboolean scrolling);
#endif /* __XFCE_PAGER_H__ */

5
plugins/showdesktop/Makefile.am

@ -4,6 +4,7 @@ INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"libshowdesktop\" \
-DLOCALEDIR=\"$(localedir)\" \
-DWNCK_I_KNOW_THIS_IS_UNSTABLE \
$(PLATFORM_CPPFLAGS)
plugindir = \
@ -19,6 +20,7 @@ libshowdesktop_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(LIBWNCK_CFLAGS) \
$(PLATFORM_CFLAGS)
libshowdesktop_la_LDFLAGS = \
@ -35,7 +37,8 @@ libshowdesktop_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCEGUI4_LIBS)
$(LIBXFCEGUI4_LIBS) \
$(LIBWNCK_LIBS)
libshowdesktop_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la

29
plugins/showdesktop/showdesktop.c

@ -24,6 +24,7 @@
#endif
#include <gtk/gtk.h>
#include <libwnck/libwnck.h>
#include <libxfcegui4/libxfcegui4.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4panel/xfce-panel-convenience.h>
@ -40,8 +41,8 @@ typedef struct
GtkWidget *image;
GtkTooltips *tooltips;
NetkScreen *screen;
int netk_id;
WnckScreen *screen;
int wnck_id;
int screen_id;
int style_id;
@ -80,8 +81,8 @@ showdesktop_set_size (XfcePanelPlugin *plugin, int size, ShowDesktopData *sdd)
static void
showdesktop_free_data (XfcePanelPlugin * plugin, ShowDesktopData * sdd)
{
if (sdd->netk_id)
g_signal_handler_disconnect (sdd->screen, sdd->netk_id);
if (sdd->wnck_id)
g_signal_handler_disconnect (sdd->screen, sdd->wnck_id);
if (sdd->screen_id)
g_signal_handler_disconnect (plugin, sdd->screen_id);
@ -89,7 +90,7 @@ showdesktop_free_data (XfcePanelPlugin * plugin, ShowDesktopData * sdd)
if (sdd->style_id)
g_signal_handler_disconnect (plugin, sdd->style_id);
sdd->netk_id = sdd->screen_id = sdd->style_id = 0;
sdd->wnck_id = sdd->screen_id = sdd->style_id = 0;
gtk_object_sink (GTK_OBJECT (sdd->tooltips));
panel_slice_free (ShowDesktopData, sdd);
}
@ -127,16 +128,16 @@ button_toggled (GtkWidget * button, ShowDesktopData * sdd)
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
netk_screen_toggle_showing_desktop (sdd->screen, active);
wnck_screen_toggle_showing_desktop (sdd->screen, active);
sdd->showing = active;
update_button_display (sdd);
}
static void
showing_desktop_changed (NetkScreen * screen, ShowDesktopData * sdd)
showing_desktop_changed (WnckScreen * screen, ShowDesktopData * sdd)
{
sdd->showing = netk_screen_get_showing_desktop (screen);
sdd->showing = wnck_screen_get_showing_desktop (screen);
update_button (sdd);
}
@ -144,23 +145,23 @@ static void
showdesktop_screen_changed (XfcePanelPlugin *plugin, GdkScreen *screen,
ShowDesktopData *sdd)
{
if (sdd->netk_id)
if (sdd->wnck_id)
{
g_signal_handler_disconnect (sdd->screen, sdd->netk_id);
sdd->netk_id = 0;
g_signal_handler_disconnect (sdd->screen, sdd->wnck_id);
sdd->wnck_id = 0;
}
screen = gtk_widget_get_screen (GTK_WIDGET (plugin));
if (screen)
{
sdd->screen = netk_screen_get (gdk_screen_get_number (screen));
sdd->screen = wnck_screen_get (gdk_screen_get_number (screen));
sdd->netk_id =
sdd->wnck_id =
g_signal_connect (sdd->screen, "showing_desktop_changed",
G_CALLBACK (showing_desktop_changed), sdd);
sdd->showing = netk_screen_get_showing_desktop (sdd->screen);
sdd->showing = wnck_screen_get_showing_desktop (sdd->screen);
update_button (sdd);
showdesktop_set_size (plugin, xfce_panel_plugin_get_size (plugin), sdd);
}

5
plugins/tasklist/Makefile.am

@ -4,6 +4,7 @@ INCLUDES = \
-I$(top_srcdir) \
-DG_LOG_DOMAIN=\"libtasklist\" \
-DLOCALEDIR=\"$(localedir)\" \
-DWNCK_I_KNOW_THIS_IS_UNSTABLE \
$(PLATFORM_CPPFLAGS)
plugindir = \
@ -22,6 +23,7 @@ libtasklist_la_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(LIBWNCK_CFLAGS) \
$(PLATFORM_CFLAGS)
libtasklist_la_LDFLAGS = \
@ -38,7 +40,8 @@ libtasklist_la_LIBADD = \
$(top_builddir)/libxfce4panel/libxfce4panel.la \
$(GTK_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCEGUI4_LIBS)
$(LIBXFCEGUI4_LIBS) \
$(LIBWNCK_LIBS)
libtasklist_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel.la

85
plugins/tasklist/tasklist-dialogs.c

@ -28,79 +28,65 @@
/* prototypes */
static void tasklist_all_workspaces_toggled (GtkToggleButton *tb,
Tasklist *tasklist);
TasklistPlugin *tasklist);
static void tasklist_grouping_changed (GtkComboBox *cb,
Tasklist *tasklist);
static void tasklist_show_label_toggled (GtkToggleButton *tb,
Tasklist *tasklist);
TasklistPlugin *tasklist);
static void tasklist_expand_toggled (GtkToggleButton *tb,
Tasklist *tasklist);
TasklistPlugin *tasklist);
static void tasklist_flat_buttons_toggled (GtkToggleButton *tb,
Tasklist *tasklist);
TasklistPlugin *tasklist);
static void tasklist_show_handle_toggled (GtkToggleButton *tb,
Tasklist *tasklist);
TasklistPlugin *tasklist);
static void tasklist_width_changed (GtkSpinButton *sb,
Tasklist *tasklist);
TasklistPlugin *tasklist);
static void tasklist_dialog_response (GtkWidget *dlg,
gint reponse,
Tasklist *tasklist);
TasklistPlugin *tasklist);
static void
tasklist_all_workspaces_toggled (GtkToggleButton *tb,
Tasklist *tasklist)
TasklistPlugin *tasklist)
{
tasklist->all_workspaces = gtk_toggle_button_get_active (tb);
netk_tasklist_set_include_all_workspaces (NETK_TASKLIST (tasklist->list),
wnck_tasklist_set_include_all_workspaces (WNCK_TASKLIST (tasklist->list),
tasklist->all_workspaces);
}
static void
tasklist_grouping_changed (GtkComboBox *cb,
Tasklist *tasklist)
tasklist_grouping_changed (GtkComboBox *cb,
TasklistPlugin *tasklist)
{
tasklist->grouping = gtk_combo_box_get_active (cb);
netk_tasklist_set_grouping (NETK_TASKLIST (tasklist->list),
wnck_tasklist_set_grouping (WNCK_TASKLIST (tasklist->list),
tasklist->grouping);
}
static void
tasklist_show_label_toggled (GtkToggleButton *tb,
Tasklist *tasklist)
{
tasklist->show_label = gtk_toggle_button_get_active (tb);
netk_tasklist_set_show_label (NETK_TASKLIST (tasklist->list),
tasklist->show_label);
}
static void
tasklist_expand_toggled (GtkToggleButton *tb,
Tasklist *tasklist)
TasklistPlugin *tasklist)
{
tasklist->expand = gtk_toggle_button_get_active (tb);
xfce_panel_plugin_set_expand (tasklist->plugin, tasklist->expand);
xfce_panel_plugin_set_expand (tasklist->panel_plugin, tasklist->expand);
}
static void
tasklist_flat_buttons_toggled (GtkToggleButton *tb,
Tasklist *tasklist)
TasklistPlugin *tasklist)
{
tasklist->flat_buttons = gtk_toggle_button_get_active (tb);
netk_tasklist_set_button_relief (NETK_TASKLIST (tasklist->list),
wnck_tasklist_set_button_relief (WNCK_TASKLIST (tasklist->list),
tasklist->flat_buttons ?
GTK_RELIEF_NONE : GTK_RELIEF_NORMAL);
}
@ -109,7 +95,7 @@ tasklist_flat_buttons_toggled (GtkToggleButton *tb,
static void
tasklist_show_handle_toggled (GtkToggleButton *tb,
Tasklist *tasklist)
TasklistPlugin *tasklist)
{
tasklist->show_handles = gtk_toggle_button_get_active (tb);
@ -122,47 +108,46 @@ tasklist_show_handle_toggled (GtkToggleButton *tb,
static void
tasklist_width_changed (GtkSpinButton *sb,
Tasklist *tasklist)
tasklist_width_changed (GtkSpinButton *sb,
TasklistPlugin *tasklist)
{
tasklist->width = gtk_spin_button_get_value_as_int (sb);
tasklist_set_size (tasklist, xfce_panel_plugin_get_size (tasklist->plugin));
gtk_widget_queue_resize (GTK_WIDGET (tasklist->panel_plugin));
}
static void
tasklist_dialog_response (GtkWidget *dlg,
gint reponse,
Tasklist *tasklist)
tasklist_dialog_response (GtkWidget *dlg,
gint reponse,
TasklistPlugin *tasklist)
{
g_object_set_data (G_OBJECT (tasklist->plugin), "dialog", NULL);
g_object_set_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"), NULL);
gtk_widget_destroy (dlg);
xfce_panel_plugin_unblock_menu (tasklist->plugin);
tasklist_write_rc_file (tasklist);
xfce_panel_plugin_unblock_menu (tasklist->panel_plugin);
tasklist_plugin_write (tasklist);
}
void
tasklist_properties_dialog (Tasklist *tasklist)
tasklist_dialogs_configure (TasklistPlugin *tasklist)
{
GtkWidget *dlg, *mainvbox, *vbox, *frame, *cb,
*hbox, *label, *spin;
xfce_panel_plugin_block_menu (tasklist->plugin);
xfce_panel_plugin_block_menu (tasklist->panel_plugin);
dlg = xfce_titled_dialog_new_with_buttons (_("Task List"), NULL,
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
NULL);
gtk_window_set_screen (GTK_WINDOW (dlg),
gtk_widget_get_screen (GTK_WIDGET (tasklist->plugin)));
gtk_window_set_screen (GTK_WINDOW (dlg), gtk_widget_get_screen (GTK_WIDGET (tasklist->panel_plugin)));
g_object_set_data (G_OBJECT (tasklist->plugin), "dialog", dlg);
g_object_set_data (G_OBJECT (tasklist->panel_plugin), I_("dialog"), dlg);
gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER);
gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-settings");
@ -197,7 +182,7 @@ tasklist_properties_dialog (Tasklist *tasklist)
g_signal_connect (G_OBJECT (spin), "value-changed",
G_CALLBACK (tasklist_width_changed), tasklist);
if (tasklist_using_xinerama (tasklist->plugin))
if (tasklist_using_xinerama (tasklist->panel_plugin))
{
cb = gtk_check_button_new_with_mnemonic (_("Use all available space"));
gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
@ -230,16 +215,10 @@ tasklist_properties_dialog (Tasklist *tasklist)
g_signal_connect (G_OBJECT (cb), "toggled",
G_CALLBACK (tasklist_all_workspaces_toggled), tasklist);
cb = gtk_check_button_new_with_mnemonic (_("Show application _names"));
gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), tasklist->show_label);
g_signal_connect (G_OBJECT (cb), "toggled",
G_CALLBACK (tasklist_show_label_toggled), tasklist);
cb = gtk_combo_box_new_text ();
gtk_box_pack_start (GTK_BOX (vbox), cb, FALSE, FALSE, 0);
/* keep order in sync with NetkTasklistGroupingType */
/* keep order in sync with WnckTasklistGroupingType */
gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Never group tasks"));
gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Automatically group tasks"));
gtk_combo_box_append_text (GTK_COMBO_BOX (cb), _("Always group tasks"));

2
plugins/tasklist/tasklist-dialogs.h

@ -20,6 +20,6 @@
#ifndef __TASKLIST_DIALOGS_H__
#define __TASKLIST_DIALOGS_H__
void tasklist_properties_dialog (Tasklist *tasklist) G_GNUC_INTERNAL;
void tasklist_dialogs_configure (TasklistPlugin *tasklist) G_GNUC_INTERNAL;
#endif /* !__TASKLIST_DIALOGS_H__ */

537
plugins/tasklist/tasklist.c

@ -1,139 +1,363 @@
/* $Id$
/* $Id$
*
* Copyright (c) 2005-2007 Jasper Huijsmans <jasper@xfce.org>
* Copyright (c) 2005-2007 Jasper Huijsmans <jasper@xfce.org>
* Copyright (c) 2007 Nick Schermer <nick@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <libwnck/libwnck.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/xfce-hvbox.h>
#include "tasklist.h"
#include "tasklist-dialogs.h"
#define TASKLIST_HANDLE_SIZE (8)
/* prototypes */
static void tasklist_orientation_changed (Tasklist *tasklist,
GtkOrientation orientation);
static void tasklist_free_data (Tasklist *tasklist);
static void tasklist_read_rc_file (Tasklist *tasklist);
static gboolean tasklist_handle_exposed (GtkWidget *widget,
GdkEventExpose *ev,
Tasklist *tasklist);
static void tasklist_screen_changed (Tasklist *tasklist,
GdkScreen *screen);
static void tasklist_construct (XfcePanelPlugin *plugin);
static gboolean tasklist_handle_exposed (GtkWidget *widget,
GdkEventExpose *event,
TasklistPlugin *tasklist);
static GdkPixbuf *tasklist_icon_loader (const gchar *name,
gint size,
guint flags,
TasklistPlugin *tasklist);
static TasklistPlugin *tasklist_plugin_new (XfcePanelPlugin *panel_plugin);
static void tasklist_plugin_screen_changed (TasklistPlugin *tasklist,
GdkScreen *previous_screen);
static void tasklist_plugin_orientation_changed (TasklistPlugin *tasklist,
GtkOrientation orientation);
static gboolean tasklist_plugin_size_changed (TasklistPlugin *tasklist,
guint size);
static void tasklist_plugin_size_request (TasklistPlugin *tasklist,
GtkRequisition *requisition);
static void tasklist_plugin_read (TasklistPlugin *tasklist);
static void tasklist_plugin_free (TasklistPlugin *tasklist);
static void tasklist_plugin_construct (XfcePanelPlugin *panel_plugin);
/* register with the panel */
XFCE_PANEL_PLUGIN_REGISTER_INTERNAL (tasklist_construct);
XFCE_PANEL_PLUGIN_REGISTER_INTERNAL (tasklist_plugin_construct);
static void
tasklist_orientation_changed (Tasklist *tasklist,
GtkOrientation orientation)
gboolean
tasklist_using_xinerama (XfcePanelPlugin *panel_plugin)
{
return (gdk_screen_get_n_monitors (gtk_widget_get_screen (GTK_WIDGET (panel_plugin))) > 1);
}
xfce_hvbox_set_orientation (XFCE_HVBOX (tasklist->box), orientation);
gtk_widget_queue_draw (tasklist->handle);
static gboolean
tasklist_handle_exposed (GtkWidget *widget,
GdkEventExpose *event,
TasklistPlugin *tasklist)
{
GtkOrientation orientation;
gint x, y, w, h;
if (GTK_WIDGET_DRAWABLE (widget))
{
/* get the panel orientation */
orientation = xfce_panel_plugin_get_orientation (tasklist->panel_plugin);
/* set sizes */
x = widget->allocation.x;
y = widget->allocation.y;
w = widget->allocation.width;
h = widget->allocation.height;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
y += widget->style->ythickness;
h -= 2 * widget->style->ythickness;
}
else
{
x += widget->style->xthickness;
w -= 2 * widget->style->xthickness;
}
gtk_paint_handle (widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
&(event->area), widget, "handlebox",
x, y, w, h, orientation);
return TRUE;
}
return FALSE;
}
gboolean
tasklist_set_size (Tasklist *tasklist,
gint size)
static GdkPixbuf *
tasklist_icon_loader (const gchar *name,
gint size,
guint flags,
TasklistPlugin *tasklist)
{
GtkOrientation orientation;
GdkPixbuf *pixbuf = NULL;
gchar *base = NULL;
const gchar *p;
orientation = xfce_panel_plugin_get_orientation (tasklist->plugin);
/* do nothing on invalid names */
if (G_UNLIKELY (name == NULL || *name == '\0'))
return NULL;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
if (g_path_is_absolute (name))
{
gtk_widget_set_size_request (GTK_WIDGET (tasklist->plugin),
tasklist->width, size);
if (g_file_test (name, G_FILE_TEST_EXISTS))
{
/* directly load the file */
pixbuf = gdk_pixbuf_new_from_file_at_size (name, size, size, NULL);
}
else
{
/* get the base name */
base = g_path_get_basename (name);
/* use this function to try again */
pixbuf = tasklist_icon_loader (base, size, flags, tasklist);
/* cleanup */
g_free (base);
}
}
else
{
gtk_widget_set_size_request (GTK_WIDGET (tasklist->plugin),
size, tasklist->width);
/* strip prefix */
p = strrchr (name, '.');
if (G_UNLIKELY (p))