summaryrefslogtreecommitdiff
path: root/applets/wncklet/workspace-switcher.c
diff options
context:
space:
mode:
Diffstat (limited to 'applets/wncklet/workspace-switcher.c')
-rw-r--r--applets/wncklet/workspace-switcher.c96
1 files changed, 49 insertions, 47 deletions
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index cd241bea..3fcd5085 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
- * libwnck based pager applet.
+ * libmatewnck based pager applet.
* (C) 2001 Alexander Larsson
* (C) 2001 Red Hat, Inc
*
@@ -8,8 +8,6 @@
*
*/
-#define WNCK_I_KNOW_THIS_IS_UNSTABLE 1
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -23,7 +21,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <libwnck/libwnck.h>
+#include <libmatewnck/libmatewnck.h>
#include <mateconf/mateconf-client.h>
#include "workspace-switcher.h"
@@ -51,7 +49,7 @@ typedef struct {
GtkWidget* pager;
- WnckScreen* screen;
+ MatewnckScreen* screen;
PagerWM wm;
/* Properties: */
@@ -70,7 +68,7 @@ typedef struct {
GtkOrientation orientation;
int n_rows; /* for vertical layout this is cols */
- WnckPagerDisplayMode display_mode;
+ MatewnckPagerDisplayMode display_mode;
gboolean display_all;
/* mateconf listeners id */
@@ -83,14 +81,14 @@ static void display_about_dialog(GtkAction* action, PagerData* pager);
static void pager_update(PagerData* pager)
{
- wnck_pager_set_orientation(WNCK_PAGER(pager->pager), pager->orientation);
- wnck_pager_set_n_rows(WNCK_PAGER(pager->pager), pager->n_rows);
- wnck_pager_set_show_all(WNCK_PAGER(pager->pager), pager->display_all);
+ matewnck_pager_set_orientation(MATEWNCK_PAGER(pager->pager), pager->orientation);
+ matewnck_pager_set_n_rows(MATEWNCK_PAGER(pager->pager), pager->n_rows);
+ matewnck_pager_set_show_all(MATEWNCK_PAGER(pager->pager), pager->display_all);
if (pager->wm == PAGER_WM_MARCO)
- wnck_pager_set_display_mode(WNCK_PAGER(pager->pager), pager->display_mode);
+ matewnck_pager_set_display_mode(MATEWNCK_PAGER(pager->pager), pager->display_mode);
else
- wnck_pager_set_display_mode(WNCK_PAGER(pager->pager), WNCK_PAGER_DISPLAY_CONTENT);
+ matewnck_pager_set_display_mode(MATEWNCK_PAGER(pager->pager), MATEWNCK_PAGER_DISPLAY_CONTENT);
}
static void update_properties_for_wm(PagerData* pager)
@@ -129,11 +127,11 @@ static void update_properties_for_wm(PagerData* pager)
gtk_window_reshow_with_initial_size(GTK_WINDOW(pager->properties_dialog));
}
-static void window_manager_changed(WnckScreen* screen, PagerData* pager)
+static void window_manager_changed(MatewnckScreen* screen, PagerData* pager)
{
const char *wm_name;
- wm_name = wnck_screen_get_window_manager_name(screen);
+ wm_name = matewnck_screen_get_window_manager_name(screen);
if (!wm_name)
pager->wm = PAGER_WM_UNKNOWN;
@@ -194,13 +192,13 @@ static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBac
switch (type)
{
case PANEL_NO_BACKGROUND:
- wnck_pager_set_shadow_type(WNCK_PAGER(pager->pager), GTK_SHADOW_IN);
+ matewnck_pager_set_shadow_type(MATEWNCK_PAGER(pager->pager), GTK_SHADOW_IN);
break;
case PANEL_COLOR_BACKGROUND:
- wnck_pager_set_shadow_type(WNCK_PAGER(pager->pager), GTK_SHADOW_NONE);
+ matewnck_pager_set_shadow_type(MATEWNCK_PAGER(pager->pager), GTK_SHADOW_NONE);
break;
case PANEL_PIXMAP_BACKGROUND:
- wnck_pager_set_shadow_type(WNCK_PAGER(pager->pager), GTK_SHADOW_NONE);
+ matewnck_pager_set_shadow_type(MATEWNCK_PAGER(pager->pager), GTK_SHADOW_NONE);
break;
}
}
@@ -216,8 +214,8 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa
if (event->type != GDK_SCROLL)
return FALSE;
- index = wnck_workspace_get_number(wnck_screen_get_active_workspace(pager->screen));
- n_workspaces = wnck_screen_get_workspace_count(pager->screen);
+ index = matewnck_workspace_get_number(matewnck_screen_get_active_workspace(pager->screen));
+ n_workspaces = matewnck_screen_get_workspace_count(pager->screen);
n_columns = n_workspaces / pager->n_rows;
if (n_workspaces % pager->n_rows != 0)
@@ -284,7 +282,7 @@ static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, Pa
break;
}
- wnck_workspace_activate(wnck_screen_get_workspace(pager->screen, index), event->time);
+ matewnck_workspace_activate(matewnck_screen_get_workspace(pager->screen, index), event->time);
return TRUE;
}
@@ -365,11 +363,11 @@ static void display_workspace_names_changed(MateConfClient* client, guint cnxn_i
if (value)
{
- pager->display_mode = WNCK_PAGER_DISPLAY_NAME;
+ pager->display_mode = MATEWNCK_PAGER_DISPLAY_NAME;
}
else
{
- pager->display_mode = WNCK_PAGER_DISPLAY_CONTENT;
+ pager->display_mode = MATEWNCK_PAGER_DISPLAY_CONTENT;
}
pager_update(pager);
@@ -480,11 +478,11 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
if (display_names)
{
- pager->display_mode = WNCK_PAGER_DISPLAY_NAME;
+ pager->display_mode = MATEWNCK_PAGER_DISPLAY_NAME;
}
else
{
- pager->display_mode = WNCK_PAGER_DISPLAY_CONTENT;
+ pager->display_mode = MATEWNCK_PAGER_DISPLAY_CONTENT;
}
error = NULL;
@@ -510,10 +508,10 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
break;
}
- pager->pager = wnck_pager_new(NULL);
+ pager->pager = matewnck_pager_new(NULL);
pager->screen = NULL;
pager->wm = PAGER_WM_UNKNOWN;
- wnck_pager_set_shadow_type(WNCK_PAGER(pager->pager), GTK_SHADOW_IN);
+ matewnck_pager_set_shadow_type(MATEWNCK_PAGER(pager->pager), GTK_SHADOW_IN);
g_signal_connect(G_OBJECT(pager->pager), "destroy", G_CALLBACK(destroy_pager), pager);
@@ -559,18 +557,22 @@ static void display_help_dialog(GtkAction* action, PagerData* pager)
static void display_about_dialog(GtkAction* action, PagerData* pager)
{
static const gchar* authors[] = {
+ "Perberos <[email protected]>",
+ "Steve Zesch <[email protected]>",
+ "Stefano Karapetsas <[email protected]>",
"Alexander Larsson <[email protected]>",
NULL
};
const char* documenters[] = {
"John Fleck <[email protected]>",
- "Sun MATE Documentation Team <[email protected]>",
+ "Sun GNOME Documentation Team <[email protected]>",
NULL
};
char copyright[] = \
- "Copyright \xc2\xa9 2001-2002 Red Hat, Inc.";
+ "Copyright \xc2\xa9 2011 Perberos\n"
+ "Copyright \xc2\xa9 2002 Red Hat, Inc.";
gtk_show_about_dialog(GTK_WINDOW(pager->applet),
"program-name", _("Workspace Switcher"),
@@ -582,7 +584,7 @@ static void display_about_dialog(GtkAction* action, PagerData* pager)
"logo-icon-name", WORKSPACE_SWITCHER_ICON,
"translator-credits", _("translator-credits"),
"version", VERSION,
- "website", "http://matsusoft.com.ar/projects/mate/",
+ "website", "http://www.mate-desktop.org/",
NULL);
}
@@ -605,10 +607,10 @@ static void num_rows_value_changed(GtkSpinButton* button, PagerData* pager)
static void update_workspaces_model(PagerData* pager)
{
int nr_ws, i;
- WnckWorkspace* workspace;
+ MatewnckWorkspace* workspace;
GtkTreeIter iter;
- nr_ws = wnck_screen_get_workspace_count(pager->screen);
+ nr_ws = matewnck_screen_get_workspace_count(pager->screen);
if (pager->properties_dialog)
{
@@ -619,36 +621,36 @@ static void update_workspaces_model(PagerData* pager)
for (i = 0; i < nr_ws; i++)
{
- workspace = wnck_screen_get_workspace(pager->screen, i);
+ workspace = matewnck_screen_get_workspace(pager->screen, i);
gtk_list_store_append(pager->workspaces_store, &iter);
- gtk_list_store_set(pager->workspaces_store, &iter, 0, wnck_workspace_get_name(workspace), -1);
+ gtk_list_store_set(pager->workspaces_store, &iter, 0, matewnck_workspace_get_name(workspace), -1);
}
}
}
-static void workspace_renamed(WnckWorkspace* space, PagerData* pager)
+static void workspace_renamed(MatewnckWorkspace* space, PagerData* pager)
{
int i;
GtkTreeIter iter;
- i = wnck_workspace_get_number(space);
+ i = matewnck_workspace_get_number(space);
if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(pager->workspaces_store), &iter, NULL, i))
- gtk_list_store_set(pager->workspaces_store, &iter, 0, wnck_workspace_get_name(space), -1);
+ gtk_list_store_set(pager->workspaces_store, &iter, 0, matewnck_workspace_get_name(space), -1);
}
-static void workspace_created(WnckScreen* screen, WnckWorkspace* space, PagerData* pager)
+static void workspace_created(MatewnckScreen* screen, MatewnckWorkspace* space, PagerData* pager)
{
- g_return_if_fail(WNCK_IS_SCREEN(screen));
+ g_return_if_fail(MATEWNCK_IS_SCREEN(screen));
update_workspaces_model(pager);
wncklet_connect_while_alive(space, "name_changed", G_CALLBACK(workspace_renamed), pager, pager->properties_dialog);
}
-static void workspace_destroyed(WnckScreen* screen, WnckWorkspace* space, PagerData* pager)
+static void workspace_destroyed(MatewnckScreen* screen, MatewnckWorkspace* space, PagerData* pager)
{
- g_return_if_fail(WNCK_IS_SCREEN(screen));
+ g_return_if_fail(MATEWNCK_IS_SCREEN(screen));
update_workspaces_model(pager);
}
@@ -659,7 +661,7 @@ static void num_workspaces_value_changed(GtkSpinButton* button, PagerData* pager
* FIXME: remove this if bug 410520 gets fixed. */
button->timer_step = 0.2;
- wnck_screen_change_workspace_count(pager->screen, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pager->num_workspaces_spin)));
+ matewnck_screen_change_workspace_count(pager->screen, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pager->num_workspaces_spin)));
}
static gboolean workspaces_tree_focused_out(GtkTreeView* treeview, GdkEventFocus* event, PagerData* pager)
@@ -674,18 +676,18 @@ static gboolean workspaces_tree_focused_out(GtkTreeView* treeview, GdkEventFocus
static void workspace_name_edited(GtkCellRendererText* cell_renderer_text, const gchar* path, const gchar* new_text, PagerData* pager)
{
const gint* indices;
- WnckWorkspace* workspace;
+ MatewnckWorkspace* workspace;
GtkTreePath* p;
p = gtk_tree_path_new_from_string(path);
indices = gtk_tree_path_get_indices(p);
- workspace = wnck_screen_get_workspace(pager->screen, indices[0]);
+ workspace = matewnck_screen_get_workspace(pager->screen, indices[0]);
if (workspace != NULL)
{
gchar* temp_name = g_strdup(new_text);
- wnck_workspace_change_name(workspace, g_strstrip(temp_name));
+ matewnck_workspace_change_name(workspace, g_strstrip(temp_name));
g_free(temp_name);
}
@@ -826,7 +828,7 @@ static void setup_dialog(GtkBuilder* builder, PagerData* pager)
g_signal_connect(G_OBJECT(pager->display_workspaces_toggle), "toggled", (GCallback) display_workspace_names_toggled, pager);
- if (pager->display_mode == WNCK_PAGER_DISPLAY_NAME)
+ if (pager->display_mode == MATEWNCK_PAGER_DISPLAY_NAME)
{
value = TRUE;
}
@@ -867,7 +869,7 @@ static void setup_dialog(GtkBuilder* builder, PagerData* pager)
g_signal_connect(WID("done_button"), "clicked", (GCallback) close_dialog, pager);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(pager->num_workspaces_spin), wnck_screen_get_workspace_count(pager->screen));
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(pager->num_workspaces_spin), matewnck_screen_get_workspace_count(pager->screen));
g_signal_connect(G_OBJECT(pager->num_workspaces_spin), "value_changed", (GCallback) num_workspaces_value_changed, pager);
wncklet_connect_while_alive(pager->screen, "workspace_created", G_CALLBACK(workspace_created), pager, pager->properties_dialog);
@@ -887,11 +889,11 @@ static void setup_dialog(GtkBuilder* builder, PagerData* pager)
gtk_tree_view_append_column(GTK_TREE_VIEW(pager->workspaces_tree), column);
g_signal_connect(cell, "edited", (GCallback) workspace_name_edited, pager);
- nr_ws = wnck_screen_get_workspace_count(pager->screen);
+ nr_ws = matewnck_screen_get_workspace_count(pager->screen);
for (i = 0; i < nr_ws; i++)
{
- wncklet_connect_while_alive(G_OBJECT(wnck_screen_get_workspace(pager->screen, i)), "name_changed", G_CALLBACK(workspace_renamed), pager, pager->properties_dialog);
+ wncklet_connect_while_alive(G_OBJECT(matewnck_screen_get_workspace(pager->screen, i)), "name_changed", G_CALLBACK(workspace_renamed), pager, pager->properties_dialog);
}
update_properties_for_wm(pager);