summaryrefslogtreecommitdiff
path: root/applets/wncklet
diff options
context:
space:
mode:
Diffstat (limited to 'applets/wncklet')
-rw-r--r--applets/wncklet/showdesktop.c36
-rw-r--r--applets/wncklet/window-list.c20
-rw-r--r--applets/wncklet/window-menu.c57
-rw-r--r--applets/wncklet/workspace-switcher.c175
4 files changed, 1 insertions, 287 deletions
diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c
index a205d9b0..e23ea361 100644
--- a/applets/wncklet/showdesktop.c
+++ b/applets/wncklet/showdesktop.c
@@ -130,13 +130,9 @@ static void button_size_allocated(GtkWidget* button, GtkAllocation* allocation,
static void update_icon(ShowDesktopData* sdd)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
GtkStateFlags state;
GtkBorder padding;
-#else
- GtkStyle* style;
-#endif
int width, height;
GdkPixbuf* icon;
GdkPixbuf* scaled;
@@ -151,7 +147,6 @@ static void update_icon(ShowDesktopData* sdd)
if (!sdd->icon_theme)
return;
-#if GTK_CHECK_VERSION (3, 0, 0)
state = gtk_widget_get_state_flags (sdd->button);
context = gtk_widget_get_style_context (sdd->button);
gtk_style_context_get_padding (context, state, &padding);
@@ -175,23 +170,6 @@ static void update_icon(ShowDesktopData* sdd)
#else
icon_size = sdd->size - 2 * (focus_width + focus_pad) - thickness;
#endif
-#else
- gtk_widget_style_get (sdd->button, "focus-line-width", &focus_width, "focus-padding", &focus_pad, NULL);
-
- style = gtk_widget_get_style(sdd->button);
-
- switch (sdd->orient)
- {
- case GTK_ORIENTATION_HORIZONTAL:
- thickness = style->ythickness;
- break;
- case GTK_ORIENTATION_VERTICAL:
- thickness = style->xthickness;
- break;
- }
-
- icon_size = sdd->size - 2 * (focus_width + focus_pad) - thickness;
-#endif
if (icon_size < 22)
icon_size = 16;
@@ -409,11 +387,9 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet)
GtkActionGroup* action_group;
gchar* ui_path;
AtkObject* atk_obj;
-#if GTK_CHECK_VERSION (3, 0, 0)
#if !GTK_CHECK_VERSION (3, 20, 0)
GtkCssProvider *provider;
#endif
-#endif
mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR);
@@ -443,7 +419,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet)
sdd->button = gtk_toggle_button_new ();
gtk_widget_set_name (sdd->button, "showdesktop-button");
-#if GTK_CHECK_VERSION (3, 0, 0)
#if !GTK_CHECK_VERSION (3, 20, 0)
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,
@@ -457,17 +432,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet)
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
#endif
-#else
- gtk_rc_parse_string ("\n"
- " style \"showdesktop-button-style\"\n"
- " {\n"
- " GtkWidget::focus-line-width=0\n"
- " GtkWidget::focus-padding=0\n"
- " }\n"
- "\n"
- " widget \"*.showdesktop-button\" style \"showdesktop-button-style\"\n"
- "\n");
-#endif
atk_obj = gtk_widget_get_accessible(sdd->button);
atk_object_set_name (atk_obj, _("Show Desktop Button"));
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index b9db7e3c..2b7e2974 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -119,27 +119,17 @@ static void applet_change_orient(MatePanelApplet* applet, MatePanelAppletOrient
tasklist->orientation = new_orient;
-#ifdef WNCK_CHECK_VERSION
#if WNCK_CHECK_VERSION (3, 4, 6)
wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), new_orient);
#endif
-#endif
tasklist_update(tasklist);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, cairo_pattern_t* pattern, TasklistData* tasklist)
-#else
-static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap, TasklistData* tasklist)
-#endif
{
switch (type)
{
case PANEL_NO_BACKGROUND:
-#if !GTK_CHECK_VERSION (3, 0 ,0)
- wnck_tasklist_set_button_relief(WNCK_TASKLIST(tasklist->tasklist), GTK_RELIEF_NORMAL);
- break;
-#endif
case PANEL_COLOR_BACKGROUND:
case PANEL_PIXMAP_BACKGROUND:
wnck_tasklist_set_button_relief(WNCK_TASKLIST(tasklist->tasklist), GTK_RELIEF_NONE);
@@ -424,22 +414,12 @@ gboolean window_list_applet_fill(MatePanelApplet* applet)
break;
}
-#ifdef WNCK_CHECK_VERSION
-#if WNCK_CHECK_VERSION (3, 0, 0)
tasklist->tasklist = wnck_tasklist_new();
-#else
- tasklist->tasklist = wnck_tasklist_new(NULL);
-#endif
-#else
- tasklist->tasklist = wnck_tasklist_new(NULL);
-#endif
-#ifdef WNCK_CHECK_VERSION
#if WNCK_CHECK_VERSION (3, 4, 6)
wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), tasklist->orientation);
wnck_tasklist_set_middle_click_close (WNCK_TASKLIST (tasklist->tasklist), TRUE);
#endif
-#endif
wnck_tasklist_set_icon_loader(WNCK_TASKLIST(tasklist->tasklist), icon_loader_func, tasklist, NULL);
diff --git a/applets/wncklet/window-menu.c b/applets/wncklet/window-menu.c
index 7f40caac..cbc867d1 100644
--- a/applets/wncklet/window-menu.c
+++ b/applets/wncklet/window-menu.c
@@ -117,7 +117,6 @@ static void window_menu_destroy(GtkWidget* widget, WindowMenu* window_menu)
g_free(window_menu);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean window_menu_on_draw (GtkWidget* widget,
cairo_t* cr,
gpointer data)
@@ -145,28 +144,7 @@ static gboolean window_menu_on_draw (GtkWidget* widget,
return FALSE;
}
-#else
-static gboolean window_menu_on_expose (GtkWidget* widget,
- GdkEventExpose* event,
- gpointer data)
-{
- WindowMenu* window_menu = data;
-
- if (gtk_widget_has_focus(window_menu->applet))
- gtk_paint_focus(gtk_widget_get_style(widget),
- gtk_widget_get_window(widget),
- gtk_widget_get_state(widget),
- NULL,
- widget,
- "menu-applet",
- 0, 0,
- -1, -1);
-
- return FALSE;
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
#if !GTK_CHECK_VERSION (3, 20, 0)
static inline void force_no_focus_padding(GtkWidget* widget)
{
@@ -187,28 +165,6 @@ static inline void force_no_focus_padding(GtkWidget* widget)
gtk_widget_set_name(widget, "PanelApplet-window-menu-applet-button");
}
#endif
-#else
-static inline void force_no_focus_padding(GtkWidget* widget)
-{
- gboolean first_time = TRUE;
-
- if (first_time)
- {
- gtk_rc_parse_string("\n"
- " style \"window-menu-applet-button-style\"\n"
- " {\n"
- " GtkWidget::focus-line-width=0\n"
- " GtkWidget::focus-padding=0\n"
- " }\n"
- "\n"
- " widget \"*.PanelApplet-window-menu-applet-button\" style \"window-menu-applet-button-style\"\n"
- "\n");
- first_time = FALSE;
- }
-
- gtk_widget_set_name(widget, "PanelApplet-window-menu-applet-button");
-}
-#endif
static void window_menu_size_allocate(MatePanelApplet* applet, GtkAllocation* allocation, WindowMenu* window_menu)
{
@@ -265,15 +221,6 @@ static gboolean window_menu_key_press_event(GtkWidget* widget, GdkEventKey* even
*/
menu_shell = GTK_MENU_SHELL(selector);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- if (!menu_shell->active)
- {
- gtk_grab_add(GTK_WIDGET(menu_shell));
- menu_shell->have_grab = TRUE;
- menu_shell->active = TRUE;
- }
-#endif
-
gtk_menu_shell_select_first(menu_shell, FALSE);
return TRUE;
default:
@@ -331,11 +278,7 @@ gboolean window_menu_applet_fill(MatePanelApplet* applet)
g_signal_connect_after(G_OBJECT(window_menu->applet), "focus-in-event", G_CALLBACK(gtk_widget_queue_draw), window_menu);
g_signal_connect_after(G_OBJECT(window_menu->applet), "focus-out-event", G_CALLBACK(gtk_widget_queue_draw), window_menu);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect_after(G_OBJECT(window_menu->selector), "draw", G_CALLBACK(window_menu_on_draw), window_menu);
-#else
- g_signal_connect_after(G_OBJECT(window_menu->selector), "expose-event", G_CALLBACK(window_menu_on_expose), window_menu);
-#endif
g_signal_connect(G_OBJECT(window_menu->selector), "button_press_event", G_CALLBACK(filter_button_press), window_menu);
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index f61ba4cc..e88839dd 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -131,16 +131,11 @@ static void update_properties_for_wm(PagerData* pager)
g_assert_not_reached();
}
-#if GTK_CHECK_VERSION (3, 0, 0)
if (pager->properties_dialog) {
gtk_widget_hide (pager->properties_dialog);
gtk_widget_unrealize (pager->properties_dialog);
gtk_widget_show (pager->properties_dialog);
}
-#else
- if (pager->properties_dialog)
- gtk_window_reshow_with_initial_size(GTK_WINDOW(pager->properties_dialog));
-#endif
}
static void window_manager_changed(WnckScreen* screen, PagerData* pager)
@@ -203,7 +198,6 @@ static void applet_change_orient(MatePanelApplet* applet, MatePanelAppletOrient
gtk_label_set_text(GTK_LABEL(pager->label_row_col), pager->orientation == GTK_ORIENTATION_HORIZONTAL ? _("rows") : _("columns"));
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, cairo_pattern_t *pattern, PagerData* pager)
{
GtkStyleContext *new_context;
@@ -214,147 +208,8 @@ static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBac
wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager),
type == PANEL_NO_BACKGROUND ? GTK_SHADOW_NONE : GTK_SHADOW_IN);
-#else
-static void applet_change_background(MatePanelApplet* applet, MatePanelAppletBackgroundType type, GdkColor* color, GdkPixmap* pixmap, PagerData* pager)
-{
- /* taken from the TrashApplet */
- GtkRcStyle *rc_style;
- GtkStyle *style;
-
- /* reset style */
- gtk_widget_set_style (GTK_WIDGET (pager->pager), NULL);
- rc_style = gtk_rc_style_new ();
- gtk_widget_modify_style (GTK_WIDGET (pager->pager), rc_style);
- g_object_unref (rc_style);
-
- switch (type)
- {
- case PANEL_COLOR_BACKGROUND:
- gtk_widget_modify_bg (GTK_WIDGET (pager->pager), GTK_STATE_NORMAL, color);
- break;
-
- case PANEL_PIXMAP_BACKGROUND:
- style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (pager->pager)));
- if (style->bg_pixmap[GTK_STATE_NORMAL])
- g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]);
- style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref(pixmap);
- gtk_widget_set_style (GTK_WIDGET (pager->pager), style);
- g_object_unref (style);
- break;
-
- case PANEL_NO_BACKGROUND:
- default:
- break;
- }
-#endif
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static gboolean applet_scroll(MatePanelApplet* applet, GdkEventScroll* event, PagerData* pager)
-{
- GdkScrollDirection absolute_direction;
- int index;
- int n_workspaces;
- int n_columns;
- int in_last_row;
-
- 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);
- n_columns = n_workspaces / pager->n_rows;
-
- if (n_workspaces % pager->n_rows != 0)
- n_columns++;
-
- in_last_row = n_workspaces % n_columns;
-
- absolute_direction = event->direction;
-
- if (gtk_widget_get_direction(GTK_WIDGET(applet)) == GTK_TEXT_DIR_RTL)
- {
- switch (event->direction)
- {
- case GDK_SCROLL_DOWN:
- case GDK_SCROLL_UP:
- break;
- case GDK_SCROLL_RIGHT:
- absolute_direction = GDK_SCROLL_LEFT;
- break;
- case GDK_SCROLL_LEFT:
- absolute_direction = GDK_SCROLL_RIGHT;
- break;
- }
- }
-
- switch (absolute_direction)
- {
- case GDK_SCROLL_DOWN:
- if (index + n_columns < n_workspaces)
- {
- index += n_columns;
- }
- else if (pager->wrap_workspaces && index == n_workspaces - 1)
- {
- index = 0;
- }
- else if ((index < n_workspaces - 1 && index + in_last_row != n_workspaces - 1) || (index == n_workspaces - 1 && in_last_row != 0))
- {
- index = (index % n_columns) + 1;
- }
- break;
-
- case GDK_SCROLL_RIGHT:
- if (index < n_workspaces - 1)
- {
- index++;
- }
- else if (pager->wrap_workspaces)
- {
- index = 0;
- }
- break;
-
- case GDK_SCROLL_UP:
- if (index - n_columns >= 0)
- {
- index -= n_columns;
- }
- else if (index > 0)
- {
- index = ((pager->n_rows - 1) * n_columns) + (index % n_columns) - 1;
- }
- else if (pager->wrap_workspaces)
- {
- index = n_workspaces - 1;
- }
-
- if (index >= n_workspaces)
- index -= n_columns;
- break;
-
- case GDK_SCROLL_LEFT:
- if (index > 0)
- {
- index--;
- }
- else if (pager->wrap_workspaces)
- {
- index = n_workspaces - 1;
- }
- break;
- default:
- g_assert_not_reached();
- break;
- }
-
- wnck_workspace_activate(wnck_screen_get_workspace(pager->screen, index), event->time);
-
- return TRUE;
-}
-#endif
-
static void destroy_pager(GtkWidget* widget, PagerData* pager)
{
g_object_unref (pager->settings);
@@ -502,9 +357,7 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
GtkActionGroup* action_group;
gchar* ui_path;
gboolean display_names;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkCssProvider *provider;
-#endif
pager = g_new0(PagerData, 1);
@@ -546,20 +399,11 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
break;
}
-#ifdef WNCK_CHECK_VERSION
-#if WNCK_CHECK_VERSION (3, 0, 0)
pager->pager = wnck_pager_new();
-#else
- pager->pager = wnck_pager_new(NULL);
-#endif
-#else
- pager->pager = wnck_pager_new(NULL);
-#endif
pager->screen = NULL;
pager->wm = PAGER_WM_UNKNOWN;
wnck_pager_set_shadow_type(WNCK_PAGER(pager->pager), GTK_SHADOW_IN);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (applet));
gtk_style_context_add_class (context, "wnck-applet");
@@ -575,7 +419,7 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
g_object_unref (provider);
-#endif
+
g_signal_connect(G_OBJECT(pager->pager), "destroy", G_CALLBACK(destroy_pager), pager);
gtk_container_add(GTK_CONTAINER(pager->applet), pager->pager);
@@ -584,9 +428,6 @@ gboolean workspace_switcher_applet_fill(MatePanelApplet* applet)
g_signal_connect(G_OBJECT(pager->applet), "realize", G_CALLBACK(applet_realized), pager);
g_signal_connect(G_OBJECT(pager->applet), "unrealize", G_CALLBACK(applet_unrealized), pager);
g_signal_connect(G_OBJECT(pager->applet), "change_orient", G_CALLBACK(applet_change_orient), pager);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(pager->applet), "scroll-event", G_CALLBACK(applet_scroll), pager);
-#endif
g_signal_connect(G_OBJECT(pager->applet), "change_background", G_CALLBACK(applet_change_background), pager);
gtk_widget_show(pager->applet);
@@ -726,13 +567,6 @@ static void workspace_destroyed(WnckScreen* screen, WnckWorkspace* space, PagerD
static void num_workspaces_value_changed(GtkSpinButton* button, PagerData* pager)
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* Slow down a bit after the first change, since it's moving really to
- * fast. See bug #336731 for background.
- * FIXME: remove this if bug 410520 gets fixed. */
- button->timer_step = 0.2;
-#endif
-
wnck_screen_change_workspace_count(pager->screen, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(pager->num_workspaces_spin)));
}
@@ -806,10 +640,8 @@ static void close_dialog(GtkWidget* button, gpointer data)
{
PagerData* pager = data;
GtkTreeViewColumn* col;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkCellArea *area;
GtkCellEditable *edit_widget;
-#endif
/* This is a hack. The "editable" signal for GtkCellRenderer is emitted
only on button press or focus cycle. Hence when the user changes the
@@ -820,15 +652,10 @@ static void close_dialog(GtkWidget* button, gpointer data)
col = gtk_tree_view_get_column(GTK_TREE_VIEW(pager->workspaces_tree), 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col));
edit_widget = gtk_cell_area_get_edit_widget (area);
if (edit_widget)
gtk_cell_editable_editing_done (edit_widget);
-#else
- if (col->editable_widget != NULL && GTK_IS_CELL_EDITABLE(col->editable_widget))
- gtk_cell_editable_editing_done(col->editable_widget);
-#endif
gtk_widget_destroy(pager->properties_dialog);
}