[gnome-panel] wncklet: avoid prototypes
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] wncklet: avoid prototypes
- Date: Tue, 1 Nov 2016 12:04:45 +0000 (UTC)
commit 2fdc2f07f8bd57e53f2c70afdd59b75482dc5124
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Oct 31 21:51:19 2016 +0200
wncklet: avoid prototypes
applets/wncklet/showdesktop.c | 265 +++++++++++++++-------------------
applets/wncklet/showdesktop.h | 15 +--
applets/wncklet/window-list.c | 218 ++++++++++++++--------------
applets/wncklet/window-list.h | 21 ++-
applets/wncklet/window-menu.c | 13 +--
applets/wncklet/window-menu.h | 7 +-
applets/wncklet/workspace-switcher.c | 229 +++++++++++++++---------------
applets/wncklet/workspace-switcher.h | 21 ++-
8 files changed, 387 insertions(+), 402 deletions(-)
---
diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c
index 4b5489e..5c0ac6c 100644
--- a/applets/wncklet/showdesktop.c
+++ b/applets/wncklet/showdesktop.c
@@ -1,6 +1,3 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* "Show desktop" panel applet */
-
/*
* Copyright (C) 2002 Red Hat, Inc.
* Developed by Havoc Pennington
@@ -19,28 +16,21 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
+#include <gdk/gdkx.h>
#include <glib/gi18n.h>
-
#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-
#include <libwnck/libwnck.h>
+#include <string.h>
#include "wncklet.h"
#include "showdesktop.h"
-#include <string.h>
-
#define TIMEOUT_ACTIVATE_SECONDS 1
#define SHOW_DESKTOP_ICON "user-desktop"
-
typedef struct {
- /* widgets */
GtkWidget *applet;
GtkWidget *button;
GtkWidget *image;
@@ -53,78 +43,9 @@ typedef struct {
guint showing_desktop : 1;
guint button_activate;
- GtkIconTheme *icon_theme;
+ GtkIconTheme *icon_theme;
} ShowDesktopData;
-static void update_icon (ShowDesktopData *sdd);
-static void update_button_state (ShowDesktopData *sdd);
-static void update_button_display (ShowDesktopData *sdd);
-
-static void theme_changed_callback (GtkIconTheme *icon_theme,
- ShowDesktopData *sdd);
-
-static void button_toggled_callback (GtkWidget *button,
- ShowDesktopData *sdd);
-static void show_desktop_changed_callback (WnckScreen *screen,
- ShowDesktopData *sdd);
-
-/* this is when the panel orientation changes */
-
-static void
-applet_change_orient (PanelApplet *applet,
- PanelAppletOrient orient,
- ShowDesktopData *sdd)
-{
- GtkOrientation new_orient;
-
- switch (orient)
- {
- case PANEL_APPLET_ORIENT_LEFT:
- case PANEL_APPLET_ORIENT_RIGHT:
- new_orient = GTK_ORIENTATION_VERTICAL;
- break;
- case PANEL_APPLET_ORIENT_UP:
- case PANEL_APPLET_ORIENT_DOWN:
- default:
- new_orient = GTK_ORIENTATION_HORIZONTAL;
- break;
- }
-
- if (new_orient == sdd->orient)
- return;
-
- sdd->orient = new_orient;
-
- update_icon (sdd);
-}
-
-/* this is when the panel size changes */
-static void
-button_size_allocated (GtkWidget *button,
- GtkAllocation *allocation,
- ShowDesktopData *sdd)
-{
- if (((sdd->orient == GTK_ORIENTATION_HORIZONTAL)
- && (sdd->size == allocation->height))
- || ((sdd->orient == GTK_ORIENTATION_VERTICAL)
- && (sdd->size == allocation->width)))
- return;
-
- switch (sdd->orient) {
- case GTK_ORIENTATION_HORIZONTAL:
- sdd->size = allocation->height;
- break;
- case GTK_ORIENTATION_VERTICAL:
- sdd->size = allocation->width;
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- update_icon (sdd);
-}
-
static void
update_icon (ShowDesktopData *sdd)
{
@@ -218,6 +139,60 @@ update_icon (ShowDesktopData *sdd)
g_object_unref (icon);
}
+static void
+applet_change_orient (PanelApplet *applet,
+ PanelAppletOrient orient,
+ ShowDesktopData *sdd)
+{
+ GtkOrientation new_orient;
+
+ switch (orient)
+ {
+ case PANEL_APPLET_ORIENT_LEFT:
+ case PANEL_APPLET_ORIENT_RIGHT:
+ new_orient = GTK_ORIENTATION_VERTICAL;
+ break;
+ case PANEL_APPLET_ORIENT_UP:
+ case PANEL_APPLET_ORIENT_DOWN:
+ default:
+ new_orient = GTK_ORIENTATION_HORIZONTAL;
+ break;
+ }
+
+ if (new_orient == sdd->orient)
+ return;
+
+ sdd->orient = new_orient;
+
+ update_icon (sdd);
+}
+
+static void
+button_size_allocated (GtkWidget *button,
+ GtkAllocation *allocation,
+ ShowDesktopData *sdd)
+{
+ if (((sdd->orient == GTK_ORIENTATION_HORIZONTAL)
+ && (sdd->size == allocation->height))
+ || ((sdd->orient == GTK_ORIENTATION_VERTICAL)
+ && (sdd->size == allocation->width)))
+ return;
+
+ switch (sdd->orient) {
+ case GTK_ORIENTATION_HORIZONTAL:
+ sdd->size = allocation->height;
+ break;
+ case GTK_ORIENTATION_VERTICAL:
+ sdd->size = allocation->width;
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ update_icon (sdd);
+}
+
/* This updates things that should be consistent with the button's appearance,
* and update_button_state updates the button appearance itself
*/
@@ -236,6 +211,51 @@ update_button_display (ShowDesktopData *sdd)
}
static void
+button_toggled_callback (GtkWidget *button,
+ ShowDesktopData *sdd)
+{
+ if (!gdk_x11_screen_supports_net_wm_hint (gtk_widget_get_screen (button),
+ gdk_atom_intern ("_NET_SHOWING_DESKTOP", FALSE))) {
+ static GtkWidget *dialog = NULL;
+
+ if (dialog &&
+ gtk_widget_get_screen (dialog) != gtk_widget_get_screen (button))
+ gtk_widget_destroy (dialog);
+
+ if (dialog) {
+ gtk_window_present (GTK_WINDOW (dialog));
+ return;
+ }
+
+ dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _("Your window manager does not support the show desktop
button, or you are not running a window manager."));
+
+ g_object_add_weak_pointer (G_OBJECT (dialog),
+ (gpointer) &dialog);
+
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+ gtk_window_set_screen (GTK_WINDOW (dialog),
+ gtk_widget_get_screen (button));
+ gtk_widget_show (dialog);
+
+ return;
+ }
+
+ if (sdd->wnck_screen != NULL)
+ wnck_screen_toggle_showing_desktop (sdd->wnck_screen,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(button)));
+
+ update_button_display (sdd);
+}
+
+static void
update_button_state (ShowDesktopData *sdd)
{
if (sdd->showing_desktop) {
@@ -262,6 +282,23 @@ update_button_state (ShowDesktopData *sdd)
}
static void
+show_desktop_changed_callback (WnckScreen *screen,
+ ShowDesktopData *sdd)
+{
+ if (sdd->wnck_screen != NULL)
+ sdd->showing_desktop =
+ wnck_screen_get_showing_desktop (sdd->wnck_screen);
+ update_button_state (sdd);
+}
+
+static void
+theme_changed_callback (GtkIconTheme *icon_theme,
+ ShowDesktopData *sdd)
+{
+ update_icon (sdd);
+}
+
+static void
applet_destroyed (GtkWidget *applet,
ShowDesktopData *sdd)
{
@@ -382,13 +419,6 @@ show_desktop_applet_realized (PanelApplet *applet,
update_icon (sdd);
}
-static void
-theme_changed_callback (GtkIconTheme *icon_theme,
- ShowDesktopData *sdd)
-{
- update_icon (sdd);
-}
-
gboolean
show_desktop_applet_fill (PanelApplet *applet)
{
@@ -466,58 +496,3 @@ show_desktop_applet_fill (PanelApplet *applet)
return TRUE;
}
-
-static void
-button_toggled_callback (GtkWidget *button,
- ShowDesktopData *sdd)
-{
- if (!gdk_x11_screen_supports_net_wm_hint (gtk_widget_get_screen (button),
- gdk_atom_intern ("_NET_SHOWING_DESKTOP", FALSE))) {
- static GtkWidget *dialog = NULL;
-
- if (dialog &&
- gtk_widget_get_screen (dialog) != gtk_widget_get_screen (button))
- gtk_widget_destroy (dialog);
-
- if (dialog) {
- gtk_window_present (GTK_WINDOW (dialog));
- return;
- }
-
- dialog = gtk_message_dialog_new (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Your window manager does not support the show desktop
button, or you are not running a window manager."));
-
- g_object_add_weak_pointer (G_OBJECT (dialog),
- (gpointer) &dialog);
-
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
-
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- gtk_window_set_screen (GTK_WINDOW (dialog),
- gtk_widget_get_screen (button));
- gtk_widget_show (dialog);
-
- return;
- }
-
- if (sdd->wnck_screen != NULL)
- wnck_screen_toggle_showing_desktop (sdd->wnck_screen,
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(button)));
-
- update_button_display (sdd);
-}
-
-static void
-show_desktop_changed_callback (WnckScreen *screen,
- ShowDesktopData *sdd)
-{
- if (sdd->wnck_screen != NULL)
- sdd->showing_desktop =
- wnck_screen_get_showing_desktop (sdd->wnck_screen);
- update_button_state (sdd);
-}
diff --git a/applets/wncklet/showdesktop.h b/applets/wncklet/showdesktop.h
index a75c909..1694ae7 100644
--- a/applets/wncklet/showdesktop.h
+++ b/applets/wncklet/showdesktop.h
@@ -1,10 +1,7 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* "Show desktop" panel applet */
-
-/*
+/*
* Copyright (C) 2002 Red Hat, Inc.
* Developed by Havoc Pennington
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
@@ -14,13 +11,13 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _SHOWDESKTOP_H_
-#define _SHOWDESKTOP_H_
+#ifndef SHOW_DESKTOP_APPLET_H
+#define SHOW_DESKTOP_APPLET_H
#include <glib.h>
#include <panel-applet.h>
@@ -32,5 +29,3 @@ gboolean show_desktop_applet_fill (PanelApplet *applet);
G_END_DECLS
#endif
-
-
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c
index 676e4af..d51cd8c 100644
--- a/applets/wncklet/window-list.c
+++ b/applets/wncklet/window-list.c
@@ -1,24 +1,30 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
/*
- * libwnck based tasklist applet.
- * (C) 2001 Red Hat, Inc
- * (C) 2001 Alexander Larsson
+ * Copyright (C) 2001 Red Hat, Inc
+ * Copyright (C) 2001 Alexander Larsson
*
- * Authors: Alexander Larsson
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*
+ * Authors: Alexander Larsson
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <panel-applet.h>
+#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libwnck/libwnck.h>
+#include <panel-applet.h>
+#include <string.h>
#include "wncklet.h"
#include "window-list.h"
@@ -36,7 +42,7 @@ typedef struct {
GtkOrientation orientation;
int size;
- GtkIconTheme *icon_theme;
+ GtkIconTheme *icon_theme;
/* Properties: */
GtkWidget *properties_dialog;
@@ -49,13 +55,9 @@ typedef struct {
GtkWidget *move_minimized_radio;
GtkWidget *change_workspace_radio;
- GSettings *settings;
+ GSettings *settings;
} TasklistData;
-static void display_properties_dialog (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data);
-
static void
tasklist_update (TasklistData *tasklist)
{
@@ -131,10 +133,6 @@ destroy_tasklist(GtkWidget * widget, TasklistData *tasklist)
g_free (tasklist);
}
-static const GActionEntry tasklist_menu_actions [] = {
- { "preferences", display_properties_dialog, NULL, NULL, NULL },
-};
-
static void
tasklist_properties_update_content_radio (TasklistData *tasklist)
{
@@ -340,91 +338,6 @@ icon_loader_func (const char *icon,
return retval;
}
-gboolean
-window_list_applet_fill (PanelApplet *applet)
-{
- TasklistData *tasklist;
- GSimpleActionGroup *action_group;
- GAction *action;
-
- tasklist = g_new0 (TasklistData, 1);
-
- tasklist->applet = GTK_WIDGET (applet);
-
- panel_applet_set_flags (PANEL_APPLET (tasklist->applet),
- PANEL_APPLET_EXPAND_MAJOR |
- PANEL_APPLET_EXPAND_MINOR |
- PANEL_APPLET_HAS_HANDLE);
-
- setup_gsettings (tasklist);
-
- tasklist->include_all_workspaces = g_settings_get_boolean (tasklist->settings,
"display-all-workspaces");
- tasklist->grouping = g_settings_get_enum (tasklist->settings, "group-windows");
- tasklist->move_unminimized_windows = g_settings_get_boolean (tasklist->settings,
"move-unminimized-windows");
-
- switch (panel_applet_get_orient (applet)) {
- case PANEL_APPLET_ORIENT_LEFT:
- case PANEL_APPLET_ORIENT_RIGHT:
- tasklist->orientation = GTK_ORIENTATION_VERTICAL;
- break;
- case PANEL_APPLET_ORIENT_UP:
- case PANEL_APPLET_ORIENT_DOWN:
- default:
- tasklist->orientation = GTK_ORIENTATION_HORIZONTAL;
- break;
- }
-
- tasklist->tasklist = wnck_tasklist_new ();
-
- wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), tasklist->orientation);
- wnck_tasklist_set_icon_loader (WNCK_TASKLIST (tasklist->tasklist),
- icon_loader_func, tasklist, NULL);
-
- g_signal_connect (G_OBJECT (tasklist->tasklist), "destroy",
- G_CALLBACK (destroy_tasklist),
- tasklist);
- g_signal_connect (G_OBJECT (tasklist->applet), "size_allocate",
- G_CALLBACK (applet_size_allocate),
- tasklist);
- tasklist_update (tasklist);
- gtk_widget_show (tasklist->tasklist);
-
- 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);
-
- action_group = g_simple_action_group_new ();
- g_action_map_add_action_entries (G_ACTION_MAP (action_group),
- tasklist_menu_actions,
- G_N_ELEMENTS (tasklist_menu_actions),
- tasklist);
- panel_applet_setup_menu_from_resource (PANEL_APPLET (tasklist->applet),
- WNCKLET_RESOURCE_PATH "window-list-menu.ui",
- action_group,
- GETTEXT_PACKAGE);
-
- gtk_widget_insert_action_group (GTK_WIDGET (applet), "tasklist",
- G_ACTION_GROUP (action_group));
-
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
- g_object_bind_property (tasklist->applet, "locked-down",
- action, "enabled",
- G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
-
- g_object_unref (action_group);
-
- gtk_widget_show (tasklist->applet);
-
- return TRUE;
-}
-
static void
group_windows_toggled (GtkToggleButton *button,
TasklistData *tasklist)
@@ -555,8 +468,6 @@ setup_dialog (GtkBuilder *builder,
tasklist);
}
-
-
static void
display_properties_dialog (GSimpleAction *action,
GVariant *parameter,
@@ -589,3 +500,92 @@ display_properties_dialog (GSimpleAction *action,
gtk_widget_get_screen (tasklist->applet));
gtk_window_present (GTK_WINDOW (tasklist->properties_dialog));
}
+
+static const GActionEntry tasklist_menu_actions [] = {
+ { "preferences", display_properties_dialog, NULL, NULL, NULL },
+};
+
+gboolean
+window_list_applet_fill (PanelApplet *applet)
+{
+ TasklistData *tasklist;
+ GSimpleActionGroup *action_group;
+ GAction *action;
+
+ tasklist = g_new0 (TasklistData, 1);
+
+ tasklist->applet = GTK_WIDGET (applet);
+
+ panel_applet_set_flags (PANEL_APPLET (tasklist->applet),
+ PANEL_APPLET_EXPAND_MAJOR |
+ PANEL_APPLET_EXPAND_MINOR |
+ PANEL_APPLET_HAS_HANDLE);
+
+ setup_gsettings (tasklist);
+
+ tasklist->include_all_workspaces = g_settings_get_boolean (tasklist->settings,
"display-all-workspaces");
+ tasklist->grouping = g_settings_get_enum (tasklist->settings, "group-windows");
+ tasklist->move_unminimized_windows = g_settings_get_boolean (tasklist->settings,
"move-unminimized-windows");
+
+ switch (panel_applet_get_orient (applet)) {
+ case PANEL_APPLET_ORIENT_LEFT:
+ case PANEL_APPLET_ORIENT_RIGHT:
+ tasklist->orientation = GTK_ORIENTATION_VERTICAL;
+ break;
+ case PANEL_APPLET_ORIENT_UP:
+ case PANEL_APPLET_ORIENT_DOWN:
+ default:
+ tasklist->orientation = GTK_ORIENTATION_HORIZONTAL;
+ break;
+ }
+
+ tasklist->tasklist = wnck_tasklist_new ();
+
+ wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), tasklist->orientation);
+ wnck_tasklist_set_icon_loader (WNCK_TASKLIST (tasklist->tasklist),
+ icon_loader_func, tasklist, NULL);
+
+ g_signal_connect (G_OBJECT (tasklist->tasklist), "destroy",
+ G_CALLBACK (destroy_tasklist),
+ tasklist);
+ g_signal_connect (G_OBJECT (tasklist->applet), "size_allocate",
+ G_CALLBACK (applet_size_allocate),
+ tasklist);
+ tasklist_update (tasklist);
+ gtk_widget_show (tasklist->tasklist);
+
+ 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);
+
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ tasklist_menu_actions,
+ G_N_ELEMENTS (tasklist_menu_actions),
+ tasklist);
+ panel_applet_setup_menu_from_resource (PANEL_APPLET (tasklist->applet),
+ WNCKLET_RESOURCE_PATH "window-list-menu.ui",
+ action_group,
+ GETTEXT_PACKAGE);
+
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "tasklist",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (tasklist->applet, "locked-down",
+ action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
+
+ g_object_unref (action_group);
+
+ gtk_widget_show (tasklist->applet);
+
+ return TRUE;
+}
diff --git a/applets/wncklet/window-list.h b/applets/wncklet/window-list.h
index 125436f..3122762 100644
--- a/applets/wncklet/window-list.h
+++ b/applets/wncklet/window-list.h
@@ -1,13 +1,24 @@
/*
- * libwnck based tasklist Applet.
- * (C) 2001 Alexander Larsson
+ * Copyright (C) 2001 Alexander Larsson
*
- * Authors: Alexander Larsson
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU 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
+ * General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Alexander Larsson
*/
-#ifndef __WINDOW_LIST_H__
-#define __WINDOW_LIST_H__
+#ifndef WINDOW_LIST_APPLET_H
+#define WINDOW_LIST_APPLET_H
#include <glib.h>
#include <panel-applet.h>
diff --git a/applets/wncklet/window-menu.c b/applets/wncklet/window-menu.c
index b70e15d..b18a6cf 100644
--- a/applets/wncklet/window-menu.c
+++ b/applets/wncklet/window-menu.c
@@ -1,5 +1,4 @@
-/* window-menu.c: Window Selector applet
- *
+/*
* Copyright (C) 2003 Sun Microsystems, Inc.
* Copyright (C) 2001 Free Software Foundation, Inc.
* Copyright (C) 2000 Helix Code, Inc.
@@ -23,17 +22,13 @@
* Jacob Berkman <jacob helixcode com>
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <panel-applet.h>
+#include "config.h"
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-
#include <libwnck/libwnck.h>
+#include <panel-applet.h>
+#include <string.h>
#include "wncklet.h"
#include "window-menu.h"
diff --git a/applets/wncklet/window-menu.h b/applets/wncklet/window-menu.h
index f51c3e7..313b11a 100644
--- a/applets/wncklet/window-menu.h
+++ b/applets/wncklet/window-menu.h
@@ -1,5 +1,4 @@
-/* window-menu.h: Window Menu applet
- *
+/*
* Copyright (C) 2003 Sun Microsystems, Inc.
* Copyright (C) 2001 Free Software Foundation, Inc.
* Copyright (C) 2000 Helix Code, Inc.
@@ -24,8 +23,8 @@
* Jacob Berkman <jacob helixcode com>
*/
-#ifndef __WINDOW_MENU_H__
-#define __WINDOW_MENU_H__
+#ifndef WINDOW_MENU_APPLET_H
+#define WINDOW_MENU_APPLET_H
#include <glib.h>
#include <panel-applet.h>
diff --git a/applets/wncklet/workspace-switcher.c b/applets/wncklet/workspace-switcher.c
index a9bf1fb..67e7975 100644
--- a/applets/wncklet/workspace-switcher.c
+++ b/applets/wncklet/workspace-switcher.c
@@ -1,33 +1,36 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
- * libwnck based pager applet.
- * (C) 2001 Alexander Larsson
- * (C) 2001 Red Hat, Inc
+ * Copyright (C) 2001 Red Hat, Inc
+ * Copyright (C) 2001 Alexander Larsson
*
- * Authors: Alexander Larsson
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU 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
+ * General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Alexander Larsson
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <panel-applet.h>
-
-#include <stdlib.h>
+#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libwnck/libwnck.h>
+#include <panel-applet.h>
+#include <stdlib.h>
+#include <string.h>
#include "workspace-switcher.h"
-
#include "wncklet.h"
#define NEVER_SENSITIVE "never_sensitive"
-
#define WORKSPACE_SWITCHER_ICON "gnome-panel-workspace-switcher"
typedef enum {
@@ -63,13 +66,9 @@ typedef struct {
WnckPagerDisplayMode display_mode;
gboolean display_all;
- GSettings *settings;
+ GSettings *settings;
} PagerData;
-static void display_properties_dialog (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data);
-
static void
pager_update (PagerData *pager)
{
@@ -209,10 +208,6 @@ destroy_pager(GtkWidget * widget, PagerData *pager)
g_free (pager);
}
-static const GActionEntry pager_menu_actions [] = {
- { "preferences", display_properties_dialog, NULL, NULL, NULL },
-};
-
static void
num_rows_changed (GSettings *settings,
const gchar *key,
@@ -294,96 +289,6 @@ setup_gsettings (PagerData *pager)
G_CALLBACK (all_workspaces_changed), pager);
}
-gboolean
-workspace_switcher_applet_fill (PanelApplet *applet)
-{
- PagerData *pager;
- GSimpleActionGroup *action_group;
- GAction *action;
- gboolean display_names;
-
- pager = g_new0 (PagerData, 1);
-
- pager->applet = GTK_WIDGET (applet);
-
- panel_applet_set_flags (PANEL_APPLET (pager->applet), PANEL_APPLET_EXPAND_MINOR);
-
- setup_gsettings (pager);
-
- pager->n_rows = g_settings_get_int (pager->settings, "num-rows");
-
- display_names = g_settings_get_boolean (pager->settings, "display-workspace-names");
-
- if (display_names) {
- pager->display_mode = WNCK_PAGER_DISPLAY_NAME;
- } else {
- pager->display_mode = WNCK_PAGER_DISPLAY_CONTENT;
- }
-
- pager->display_all = g_settings_get_boolean (pager->settings, "display-all-workspaces");
-
- switch (panel_applet_get_orient (applet)) {
- case PANEL_APPLET_ORIENT_LEFT:
- case PANEL_APPLET_ORIENT_RIGHT:
- pager->orientation = GTK_ORIENTATION_VERTICAL;
- break;
- case PANEL_APPLET_ORIENT_UP:
- case PANEL_APPLET_ORIENT_DOWN:
- default:
- pager->orientation = GTK_ORIENTATION_HORIZONTAL;
- break;
- }
-
- pager->pager = wnck_pager_new ();
- pager->screen = NULL;
- pager->wm = PAGER_WM_UNKNOWN;
- wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager), GTK_SHADOW_IN);
-
- g_signal_connect (G_OBJECT (pager->pager), "destroy",
- G_CALLBACK (destroy_pager),
- pager);
-
- gtk_container_add (GTK_CONTAINER (pager->applet), pager->pager);
- gtk_widget_show (pager->pager);
-
- 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);
-
- gtk_widget_show (pager->applet);
-
- action_group = g_simple_action_group_new ();
- g_action_map_add_action_entries (G_ACTION_MAP (action_group),
- pager_menu_actions,
- G_N_ELEMENTS (pager_menu_actions),
- pager);
- panel_applet_setup_menu_from_resource (PANEL_APPLET (pager->applet),
- WNCKLET_RESOURCE_PATH "workspace-switcher-menu.ui",
- action_group,
- GETTEXT_PACKAGE);
-
- gtk_widget_insert_action_group (GTK_WIDGET (applet), "ws",
- G_ACTION_GROUP (action_group));
-
- action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
- g_object_bind_property (pager->applet, "locked-down",
- action, "enabled",
- G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
-
- g_object_unref (action_group);
-
- return TRUE;
-}
-
static void
display_workspace_names_toggled (GtkToggleButton *button,
PagerData *pager)
@@ -791,3 +696,97 @@ display_properties_dialog (GSimpleAction *action,
gtk_widget_get_screen (pager->applet));
gtk_window_present (GTK_WINDOW (pager->properties_dialog));
}
+
+static const GActionEntry pager_menu_actions [] = {
+ { "preferences", display_properties_dialog, NULL, NULL, NULL },
+};
+
+gboolean
+workspace_switcher_applet_fill (PanelApplet *applet)
+{
+ PagerData *pager;
+ GSimpleActionGroup *action_group;
+ GAction *action;
+ gboolean display_names;
+
+ pager = g_new0 (PagerData, 1);
+
+ pager->applet = GTK_WIDGET (applet);
+
+ panel_applet_set_flags (PANEL_APPLET (pager->applet), PANEL_APPLET_EXPAND_MINOR);
+
+ setup_gsettings (pager);
+
+ pager->n_rows = g_settings_get_int (pager->settings, "num-rows");
+
+ display_names = g_settings_get_boolean (pager->settings, "display-workspace-names");
+
+ if (display_names) {
+ pager->display_mode = WNCK_PAGER_DISPLAY_NAME;
+ } else {
+ pager->display_mode = WNCK_PAGER_DISPLAY_CONTENT;
+ }
+
+ pager->display_all = g_settings_get_boolean (pager->settings, "display-all-workspaces");
+
+ switch (panel_applet_get_orient (applet)) {
+ case PANEL_APPLET_ORIENT_LEFT:
+ case PANEL_APPLET_ORIENT_RIGHT:
+ pager->orientation = GTK_ORIENTATION_VERTICAL;
+ break;
+ case PANEL_APPLET_ORIENT_UP:
+ case PANEL_APPLET_ORIENT_DOWN:
+ default:
+ pager->orientation = GTK_ORIENTATION_HORIZONTAL;
+ break;
+ }
+
+ pager->pager = wnck_pager_new ();
+ pager->screen = NULL;
+ pager->wm = PAGER_WM_UNKNOWN;
+ wnck_pager_set_shadow_type (WNCK_PAGER (pager->pager), GTK_SHADOW_IN);
+
+ g_signal_connect (G_OBJECT (pager->pager), "destroy",
+ G_CALLBACK (destroy_pager),
+ pager);
+
+ gtk_container_add (GTK_CONTAINER (pager->applet), pager->pager);
+ gtk_widget_show (pager->pager);
+
+ 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);
+
+ gtk_widget_show (pager->applet);
+
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ pager_menu_actions,
+ G_N_ELEMENTS (pager_menu_actions),
+ pager);
+ panel_applet_setup_menu_from_resource (PANEL_APPLET (pager->applet),
+ WNCKLET_RESOURCE_PATH "workspace-switcher-menu.ui",
+ action_group,
+ GETTEXT_PACKAGE);
+
+ gtk_widget_insert_action_group (GTK_WIDGET (applet), "ws",
+ G_ACTION_GROUP (action_group));
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "preferences");
+ g_object_bind_property (pager->applet, "locked-down",
+ action, "enabled",
+ G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
+
+ g_object_unref (action_group);
+
+ return TRUE;
+}
diff --git a/applets/wncklet/workspace-switcher.h b/applets/wncklet/workspace-switcher.h
index e6f4b5f..daf06a7 100644
--- a/applets/wncklet/workspace-switcher.h
+++ b/applets/wncklet/workspace-switcher.h
@@ -1,13 +1,24 @@
/*
- * libwnck based pager Apple.
- * (C) 2001 Alexander Larsson
+ * Copyright (C) 2001 Alexander Larsson
*
- * Authors: Alexander Larsson
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU 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
+ * General Public License for more details.
*
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Alexander Larsson
*/
-#ifndef __WORKSPACE_SWITCHER_APPLET_H__
-#define __WORKSPACE_SWITCHER_APPLET_H__
+#ifndef WORKSPACE_SWITCHER_APPLET_H
+#define WORKSPACE_SWITCHER_APPLET_H
#include <glib.h>
#include <panel-applet.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]