[gnome-applets] window-buttons: build this applet
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets] window-buttons: build this applet
- Date: Mon, 27 Mar 2017 19:47:24 +0000 (UTC)
commit 30387dcc091d6d2a5e902d5545aba6d32f901570
Author: Gabriel Finkelstein <gabrielfinkelstein gmail com>
Date: Sat Mar 25 16:47:47 2017 -0300
window-buttons: build this applet
- update for new libpanel-applet version
- port GConf to GSettings
https://bugzilla.gnome.org/show_bug.cgi?id=770795
Makefile.am | 2 +
configure.ac | 5 +
po/POTFILES.skip | 1 +
window-buttons/Makefile.am | 98 +++---
window-buttons/external.c | 94 +++--
window-buttons/external.h | 22 +-
....gnome-applets.window-buttons.gschema.xml.in.in | 135 +++++++
...me.panel.WindowButtonsApplet.panel-applet.in.in | 5 +-
window-buttons/pixmaps/Makefile.am | 3 +-
window-buttons/preferences.c | 125 +++----
window-buttons/theme.c | 20 +-
window-buttons/themes/Makefile.am | 43 ++-
window-buttons/windowbuttons.c | 118 ++++---
window-buttons/windowbuttons.h | 61 ++--
window-buttons/windowbuttons.schemas.in | 385 --------------------
window-buttons/windowbuttons.ui | 66 ++--
16 files changed, 487 insertions(+), 696 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index e1e6a29..ff8edb6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,7 @@ always_built_SUBDIRS = \
geyes \
sticky-notes \
trash \
+ window-buttons \
windowpicker \
$(NULL)
@@ -85,6 +86,7 @@ DIST_SUBDIRS = \
trash \
cpufreq \
invest-applet \
+ window-buttons \
windowpicker \
inhibit \
brightness \
diff --git a/configure.ac b/configure.ac
index 2906e5e..2161550 100644
--- a/configure.ac
+++ b/configure.ac
@@ -705,6 +705,10 @@ AC_CONFIG_FILES([
trash/src/Makefile
trash/data/Makefile
+ window-buttons/Makefile
+ window-buttons/pixmaps/Makefile
+ window-buttons/themes/Makefile
+
windowpicker/Makefile
windowpicker/data/Makefile
windowpicker/src/Makefile
@@ -751,6 +755,7 @@ echo " sticky-notes ..................: $enable_stickynotes"
echo " timer .........................: $HAVE_LIBNOTIFY"
echo " tracker-search-bar ............: $have_tracker_search_bar"
echo " trash .........................: always"
+echo " window-buttons ................: always"
echo " windowpicker ..................: always"
echo ""
echo " charpick"
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index a243166..98174ad 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -36,4 +36,5 @@ timer/src/org.gnome.gnome-applets.timer.gschema.xml.in
tracker-search-bar/data/org.gnome.panel.SearchBar.panel-applet.in
trash/data/org.gnome.applets.TrashApplet.panel-applet.in
window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in
+window-buttons/org.gnome.gnome-applets.window-buttons.gschema.xml.in.in
window-title/org.gnome.panel.WindowTitleApplet.panel-applet.in
diff --git a/window-buttons/Makefile.am b/window-buttons/Makefile.am
old mode 100644
new mode 100755
index 4c1dbc2..cc2e6a1
--- a/window-buttons/Makefile.am
+++ b/window-buttons/Makefile.am
@@ -1,84 +1,94 @@
-AM_CPPFLAGS = \
- -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
- -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
- $(WINDOWBUTTONS_CFLAGS)
-
-AM_CFLAGS =\
- -Wall\
- -g
-
-libexec_PROGRAMS = windowbuttons
-
-windowbuttons_SOURCES = \
- windowbuttons.c\
+APPLET_LOCATION = $(pkglibdir)/libwindow-buttons-applet.so
+
+window_buttons_applet_libdir = $(pkglibdir)
+window_buttons_applet_lib_LTLIBRARIES = libwindow-buttons-applet.la
+
+libwindow_buttons_applet_la_CPPFLAGS = \
+ -I. \
+ -I$(srcdir) \
+ -DGNOMELOCALEDIR=\""$(localedir)"\" \
+ -DGTK_BUILDERDIR=\""$(pkgdatadir)/builder"\" \
+ -DDATA_DIR=\""$(datadir)"\" \
+ -DWB_DATA_DIR=\""$(pkgdatadir)/window-buttons-applet"\" \
+ $(NULL)
+
+libwindow_buttons_applet_la_CFLAGS = \
+ $(GNOME_APPLETS_CFLAGS) \
+ $(LIBWNCK_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(AM_CFLAGS) \
+ $(NULL)
+
+libwindow_buttons_applet_la_SOURCES = \
+ windowbuttons.c \
windowbuttons.h \
preferences.c \
preferences.h \
external.c \
external.h \
theme.c \
- theme.h
+ theme.h \
+ $(NULL)
-windowbuttons_LDFLAGS = \
- -Wl,--export-dynamic
+libwindow_buttons_applet_la_LDFLAGS = \
+ -avoid-version \
+ $(WARN_LDFLAGS) \
+ $(AM_LDFLAGS) \
+ $(NULL)
-windowbuttons_LDADD = $(WINDOWBUTTONS_LIBS)
+libwindow_buttons_applet_la_LIBADD = \
+ $(GNOME_APPLETS_LIBS) \
+ $(LIBWNCK_LIBS) \
+ $(LIBM) \
+ $(NULL)
# The new applet files (D-Bus???)
-appletdir = $(datadir)/gnome-panel/4.0/applets
+appletdir = $(LIBPANEL_APPLET_DIR)
applet_in_files = org.gnome.panel.WindowButtonsApplet.panel-applet.in
applet_DATA = $(applet_in_files:.panel-applet.in=.panel-applet)
$(applet_in_files): $(applet_in_files).in Makefile
$(AM_V_GEN)sed \
- -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
- -e "s|\@DATADIR\@|$(datadir)|" \
+ -e "s|\@APPLET_LOCATION\@|$(APPLET_LOCATION)|" \
-e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \
$< > $@
%.panel-applet: %.panel-applet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE)
$(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
-# The new Service file (D-Bus)
-servicedir = $(datadir)/dbus-1/services
-service_in_files = org.gnome.panel.applet.WindowButtonsAppletFactory.service.in
-service_DATA = $(service_in_files:.service.in=.service)
+gsettings_schemas_in_in = org.gnome.gnome-applets.window-buttons.gschema.xml.in.in
-org.gnome.panel.applet.WindowButtonsAppletFactory.service: $(service_in_files)
- $(AM_V_GEN)sed \
- -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
- $< > $@
+@INTLTOOL_XML_NOMERGE_RULE@
-# Schemas for GConf
-schemasdir = @GCONF_SCHEMA_FILE_DIR@
-schemas_in_files = windowbuttons.schemas.in
-schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
+gsettings_schemas_in = $(gsettings_schemas_in_in:.xml.in.in=.xml.in)
+gsettings_SCHEMAS = $(gsettings_schemas_in:.xml.in=.xml)
-windowbuttons.schemas: $(schemas_in_files)
+%.gschema.xml.in: %.gschema.xml.in.in Makefile
$(AM_V_GEN)sed \
- -e "s|\@DATADIR\@|$(datadir)|" \
+ -e 's^\@GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' \
+ -e "s|\@PKG_DATADIR\@|$(pkgdatadir)|" \
+ -e "s|\@WB_DATA_DIR\@|$(pkgdatadir)/window-buttons-applet|" \
$< > $@
-@INTLTOOL_SCHEMAS_RULE@
-
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule
$(schemas_DATA) ;
-endif
+@GSETTINGS_RULES@
# UI Builder file (Glade)
-builderdir = $(datadir)/windowbuttons
+builderdir = $(pkgdatadir)/builder
builder_DATA = windowbuttons.ui
#CLEANFILES = $(service_in_files) $(server_DATA)
-CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(schemas_DATA)
+CLEANFILES = $(applet_DATA) $(applet_DATA).in \
+ $(gsettings_SCHEMAS_in) \
+ $(gsettings_SCHEMAS) \
+ *.gschema.valid
EXTRA_DIST = \
+ $(gsettings_schemas_in_in) \
org.gnome.panel.WindowButtonsApplet.panel-applet.in.in \
- $(service_in_files) \
$(schemas_in_files) \
$(builder_DATA)
SUBDIRS = \
pixmaps\
themes
+
+-include $(top_srcdir)/git.mk
diff --git a/window-buttons/external.c b/window-buttons/external.c
old mode 100644
new mode 100755
index d4fe605..42625b9
--- a/window-buttons/external.c
+++ b/window-buttons/external.c
@@ -11,18 +11,18 @@
* 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
*/
-/*
+/*
* This file is responsible for handling of things that are a part of outside
* programs (Metacity, Compiz...).
*/
@@ -37,57 +37,79 @@ void toggleCompizDecoration(gboolean);
//void toggleMetacityDecoration(gboolean); //TODO
gchar *getMetacityLayout() {
- GConfClient *gcc = gconf_client_get_default();
- gchar *retval = gconf_client_get_string(gcc, GCONF_METACITY_BUTTON_LAYOUT, NULL);
- g_object_unref(gcc);
+ GSettings *gs = g_settings_new(GSETTINGS_METACITY_SCHEMA);
+ gchar *retval = g_settings_get_string(gs, CFG_METACITY_BUTTON_LAYOUT);
+ g_object_unref(gs);
return retval;
}
gchar *getMetacityTheme() {
- GConfClient *gcc = gconf_client_get_default();
- gchar *retval = gconf_client_get_string(gcc, GCONF_METACITY_THEME, NULL);
- g_object_unref(gcc);
+ GSettings *gs = g_settings_new(GSETTINGS_METACITY_SCHEMA);
+ gchar *retval = g_settings_get_string(gs, CFG_METACITY_THEME);
+ g_object_unref(gs);
return retval;
}
gboolean issetCompizDecoration() {
+ if(!decorPluginInstalled()) return FALSE;
+
gboolean retval = FALSE;
- GConfClient *gcc = gconf_client_get_default();
- gchar *gconf_cdm = gconf_client_get_string(gcc, GCONF_COMPIZ_DECORATION_MATCH, NULL);
- if (gconf_cdm == NULL) {
+ GSettings *settings = g_settings_new(GSETTINGS_COMPIZ_SCHEMA);
+ gchar *current_profile = g_settings_get_string(settings, CFG_COMPIZ_CURRENT_PROFILE);
+
+ gchar *path = g_strdup_printf(GSETTINGS_COMPIZ_DECOR_PATH, current_profile);
+
+ settings = g_settings_new_with_path(GSETTINGS_COMPIZ_DECOR_SCHEMA, path);
+ gchar *cdm = g_settings_get_string(settings, CFG_COMPIZ_DECORATION_MATCH);
+
+ if (cdm == NULL) {
retval = FALSE;
- } else if (!g_strcmp0(gconf_cdm, COMPIZ_DECORATION_MATCH)) {
+ } else if (!g_strcmp0(cdm, CFG_COMPIZ_DECORATION_MATCH_VALUE)) {
retval = TRUE;
}
- g_free(gconf_cdm);
- g_object_unref(gcc);
+ g_free(cdm);
+ g_free(path);
+ g_object_unref(settings);
return retval;
}
void toggleCompizDecoration(gboolean new_value) {
- GError *err = NULL;
- GConfClient *gconfclient = gconf_client_get_default();
+ if(!decorPluginInstalled()) return NULL;
+
+ GSettings *settings = g_settings_new(GSETTINGS_COMPIZ_SCHEMA);
+ gchar *current_profile = g_settings_get_string(settings, CFG_COMPIZ_CURRENT_PROFILE);
+
+ gchar *path = g_strdup_printf(GSETTINGS_COMPIZ_DECOR_PATH, current_profile);
+
+ settings = g_settings_new_with_path(GSETTINGS_COMPIZ_DECOR_SCHEMA, path);
if (new_value) {
- if (gconf_client_unset(gconfclient, GCONF_COMPIZ_DECORATION_MATCH, &err))
- gconf_client_unset(gconfclient, GCONF_COMPIZ_DECORATION_MATCH_OLD, &err);
- } else if (gconf_client_get_string(gconfclient, GCONF_COMPIZ_DECORATION_MATCH, &err)) {
- gconf_client_set_string(gconfclient,
- GCONF_COMPIZ_DECORATION_MATCH,
- COMPIZ_DECORATION_MATCH,
- NULL);
- } else if (gconf_client_get_string(gconfclient, GCONF_COMPIZ_DECORATION_MATCH_OLD, &err)) {
- gconf_client_set_string(gconfclient,
- GCONF_COMPIZ_DECORATION_MATCH_OLD,
- COMPIZ_DECORATION_MATCH,
- NULL);
- } else {
- // Compiz probably not installed. Unset newly created value.
- // TODO: This doesn't really remove it. I hate GConf.
- toggleCompizDecoration(0);
+ g_settings_reset(settings, CFG_COMPIZ_DECORATION_MATCH);
+ } else if(!new_value) {
+ g_settings_set_string(settings, CFG_COMPIZ_DECORATION_MATCH,
CFG_COMPIZ_DECORATION_MATCH_VALUE);
}
- g_free(err);
- g_object_unref(gconfclient);
-}
\ No newline at end of file
+ g_free(path);
+ g_object_unref(settings);
+}
+
+// Check if Compiz and decor plugin are installed / schema exists
+gboolean decorPluginInstalled () {
+ return gsettings_schema_exists(GSETTINGS_COMPIZ_SCHEMA)
+ && gsettings_schema_exists(GSETTINGS_COMPIZ_DECOR_SCHEMA);
+}
+
+gboolean gsettings_schema_exists (const gchar* schema) {
+ GSettingsSchemaSource *schema_source;
+ GSettingsSchema *schema_schema;
+ gboolean schema_exists;
+
+ schema_source = g_settings_schema_source_get_default();
+ schema_schema = g_settings_schema_source_lookup (schema_source, schema, TRUE);
+ schema_exists = (schema_schema != NULL);
+ if (schema_schema)
+ g_settings_schema_unref (schema_schema);
+
+ return schema_exists;
+}
diff --git a/window-buttons/external.h b/window-buttons/external.h
old mode 100644
new mode 100755
index 52f5280..03f4f7f
--- a/window-buttons/external.h
+++ b/window-buttons/external.h
@@ -11,21 +11,27 @@
* 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
*/
-#include <gconf/gconf-client.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#define GSETTINGS_METACITY_SCHEMA "org.gnome.desktop.wm.preferences"
+#define CFG_METACITY_THEME "theme"
+#define CFG_METACITY_BUTTON_LAYOUT "button-layout"
-#define GCONF_METACITY_THEME "/apps/metacity/general/theme"
-#define GCONF_METACITY_BUTTON_LAYOUT "/apps/metacity/general/button_layout"
-#define GCONF_COMPIZ_DECORATION_MATCH
"/apps/compiz-1/plugins/decor/screen0/options/decoration_match"
-#define GCONF_COMPIZ_DECORATION_MATCH_OLD
"/apps/compiz/plugins/decoration/allscreens/options/decoration_match"
-#define COMPIZ_DECORATION_MATCH "!state=maxvert"
+#define GSETTINGS_COMPIZ_SCHEMA "org.compiz"
+#define CFG_COMPIZ_CURRENT_PROFILE "current-profile"
+#define GSETTINGS_COMPIZ_DECOR_SCHEMA "org.compiz.decor"
+#define GSETTINGS_COMPIZ_DECOR_PATH "/org/compiz/profiles/%s/plugins/decor/"
+#define CFG_COMPIZ_DECORATION_MATCH "decoration-match"
+#define CFG_COMPIZ_DECORATION_MATCH_VALUE "!state=maxvert"
diff --git a/window-buttons/org.gnome.gnome-applets.window-buttons.gschema.xml.in.in
b/window-buttons/org.gnome.gnome-applets.window-buttons.gschema.xml.in.in
new file mode 100755
index 0000000..765bb38
--- /dev/null
+++ b/window-buttons/org.gnome.gnome-applets.window-buttons.gschema.xml.in.in
@@ -0,0 +1,135 @@
+<schemalist>
+ <schema id="org.gnome.gnome-applets.window-buttons">
+ <key name="btn-focused-normal-close" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/close-focused-normal.png'</default>
+ </key>
+ <key name="btn-focused-normal-minimize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/minimize-focused-normal.png'</default>
+ </key>
+ <key name="btn-focused-normal-maximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/maximize-focused-normal.png'</default>
+ </key>
+ <key name="btn-focused-normal-unmaximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/unmaximize-focused-normal.png'</default>
+ </key>
+ <key name="btn-focused-clicked-close" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/close-focused-clicked.png'</default>
+ </key>
+ <key name="btn-focused-clicked-minimize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/minimize-focused-clicked.png'</default>
+ </key>
+ <key name="btn-focused-clicked-maximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/maximize-focused-clicked.png'</default>
+ </key>
+ <key name="btn-focused-clicked-unmaximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/unmaximize-focused-clicked.png'</default>
+ </key>
+ <key name="btn-focused-hover-close" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/close-focused-hover.png'</default>
+ </key>
+ <key name="btn-focused-hover-minimize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/minimize-focused-hover.png'</default>
+ </key>
+ <key name="btn-focused-hover-maximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/maximize-focused-hover.png'</default>
+ </key>
+ <key name="btn-focused-hover-unmaximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/unmaximize-focused-hover.png'</default>
+ </key>
+ <key name="btn-unfocused-normal-close" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/close-unfocused-normal.png'</default>
+ </key>
+ <key name="btn-unfocused-normal-minimize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/minimize-unfocused-normal.png'</default>
+ </key>
+ <key name="btn-unfocused-normal-maximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/maximize-unfocused-normal.png'</default>
+ </key>
+ <key name="btn-unfocused-normal-unmaximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/unmaximize-unfocused-normal.png'</default>
+ </key>
+ <key name="btn-unfocused-clicked-close" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/close-unfocused-clicked.png'</default>
+ </key>
+ <key name="btn-unfocused-clicked-minimize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/minimize-unfocused-clicked.png'</default>
+ </key>
+ <key name="btn-unfocused-clicked-maximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/maximize-unfocused-clicked.png'</default>
+ </key>
+ <key name="btn-unfocused-clicked-unmaximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/unmaximize-unfocused-clicked.png'</default>
+ </key>
+ <key name="btn-unfocused-hover-close" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/close-unfocused-hover.png'</default>
+ </key>
+ <key name="btn-unfocused-hover-minimize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/minimize-unfocused-hover.png'</default>
+ </key>
+ <key name="btn-unfocused-hover-maximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/maximize-unfocused-normal.png'</default>
+ </key>
+ <key name="btn-unfocused-hover-unmaximize" type="s">
+ <default>'@WB_DATA_DIR@/themes/default/unmaximize-unfocused-hover.png'</default>
+ </key>
+ <key name="use-metacity-layout" type="b">
+ <default>true</default>
+ <summary>Determines whether we use custom or Metacity's button layout</summary>
+ <description>When disabled, this applet's button_layout string will be used to order the
buttons.</description>
+ </key>
+ <key name="button-layout" type="s">
+ <default>'minimize,maximize,close'</default>
+ <summary>Layout of buttons.</summary>
+ <description>Essentially a copy from Metacity's button_layout, but we can modify it for custom
settings.</description>
+ </key>
+ <key name="theme" type="s">
+ <default>'default'</default>
+ <summary>Button theme</summary>
+ <description>Name of a folder located in windowapplets/themes/ or "custom".</description>
+ </key>
+ <key name="orientation" type="i">
+ <default>0</default>
+ <summary>Button orientation</summary>
+ <description>May be used to set a static button orientation. Setting this value to 1 will ensure the
buttons are always displayed horizontally. Setting it to 2 will do the same but vertically. The default
setting 0 will set it automatically according to the panel.</description>
+ </key>
+ <key name="button-minimize-hidden" type="b">
+ <default>false</default>
+ </key>
+ <key name="button-maximize-hidden" type="b">
+ <default>false</default>
+ </key>
+ <key name="button-close-hidden" type="b">
+ <default>false</default>
+ </key>
+ <key name="hide-on-unmaximized" type="b">
+ <default>false</default>
+ <summary>Hides buttons when there are no windows present.</summary>
+ <description>When enabled, the buttons will disappear when there are no maximized (or active) windows
on the screen.</description>
+ </key>
+ <key name="only-maximized" type="b">
+ <default>true</default>
+ <summary>Only control maximized windows.</summary>
+ <description>When enabled, the window buttons will always control the upper-most maximized
window.</description>
+ </key>
+ <key name="reverse-order" type="b">
+ <default>false</default>
+ <summary>Reverse the buttons placement.</summary>
+ <description>When enabled, the window buttons will be placed in reverse order (right to left instead
of left to right, or bottom to top instead of top to bottom).</description>
+ </key>
+ <key name="click-effect" type="b">
+ <default>true</default>
+ <summary>Enable click effect.</summary>
+ <description>When enabled, the button will change image to 'clicked' whenever it is
clicked.</description>
+ </key>
+ <key name="hover-effect" type="b">
+ <default>true</default>
+ <summary>Enable hover effect.</summary>
+ <description>When enabled, the button will change image to 'hovered' whenever the mouse passes
it.</description>
+ </key>
+ <key name="show-tooltips" type="b">
+ <default>false</default>
+ <summary>Show tooltips on buttons.</summary>
+ <description>When enabled, each button will display its own tooltip, describing the function that it
represents.</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in.in
b/window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in.in
index 5ea35b6..a54297f 100644
--- a/window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in.in
+++ b/window-buttons/org.gnome.panel.WindowButtonsApplet.panel-applet.in.in
@@ -1,6 +1,7 @@
[Applet Factory]
Id=WindowButtonsAppletFactory
-Location=@LIBEXECDIR@/windowbuttons
+InProcess=true
+Location=@APPLET_LOCATION@
_Name=Window Buttons applet Factory
_Description=Window buttons for your GNOME Panel
@@ -12,4 +13,4 @@ BonoboId=OAFIID:WindowButtonsApplet
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-window-applets
X-GNOME-Bugzilla-Component=windowbuttons
-X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Bugzilla-Version=@VERSION@
\ No newline at end of file
diff --git a/window-buttons/pixmaps/Makefile.am b/window-buttons/pixmaps/Makefile.am
index e47a3ef..d1873e8 100644
--- a/window-buttons/pixmaps/Makefile.am
+++ b/window-buttons/pixmaps/Makefile.am
@@ -10,5 +10,4 @@ pixmaps_DATA = \
pixmapsdir = \
$(datadir)/pixmaps
-## File created by the gnome-build tools
-
+-include $(top_srcdir)/git.mk
diff --git a/window-buttons/preferences.c b/window-buttons/preferences.c
old mode 100644
new mode 100755
index 3cda104..e7dd71a
--- a/window-buttons/preferences.c
+++ b/window-buttons/preferences.c
@@ -11,12 +11,12 @@
* 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
@@ -43,7 +43,6 @@ void reloadButtons(WBApplet *);
const gchar *getImageCfgKey (gushort, gushort);
const gchar *getCheckBoxCfgKey (gushort);
const gchar *getImageCfgKey(gushort, gushort);
-const gchar *getImageCfgKey4(gushort, gushort);
const gchar* getButtonImageState(int, const gchar*);
const gchar* getButtonImageState4(int);
const gchar* getButtonImageName(int);
@@ -64,31 +63,30 @@ void savePreferences(WBPreferences *wbp, WBApplet *wbapplet) {
gint i, j;
for (i=0; i<WB_BUTTONS; i++) {
- //panel_applet_gconf_set_bool (wbapplet->applet, getCheckBoxCfgKey(i),
(wbapplet->button[i]->state & WB_BUTTON_STATE_HIDDEN), NULL);
- panel_applet_gconf_set_bool (wbapplet->applet, getCheckBoxCfgKey(i), wbp->button_hidden[i],
NULL);
+ g_settings_set_boolean (wbapplet->settings, getCheckBoxCfgKey(i), wbp->button_hidden[i]);
}
for (i=0; i<WB_IMAGE_STATES; i++) {
for (j=0; j<WB_IMAGES; j++) {
- panel_applet_gconf_set_string (wbapplet->applet, getImageCfgKey(i,j),
wbp->images[i][j], NULL);
+ g_settings_set_string (wbapplet->settings, getImageCfgKey(i,j), wbp->images[i][j]);
}
}
- panel_applet_gconf_set_bool (wbapplet->applet, CFG_ONLY_MAXIMIZED, wbp->only_maximized, NULL);
- panel_applet_gconf_set_bool (wbapplet->applet, CFG_CLICK_EFFECT, wbp->click_effect, NULL);
- panel_applet_gconf_set_bool (wbapplet->applet, CFG_HOVER_EFFECT, wbp->hover_effect, NULL);
- panel_applet_gconf_set_bool (wbapplet->applet, CFG_HIDE_ON_UNMAXIMIZED, wbp->hide_on_unmaximized,
NULL);
- panel_applet_gconf_set_bool (wbapplet->applet, CFG_USE_METACITY_LAYOUT, wbp->use_metacity_layout,
NULL);
- panel_applet_gconf_set_bool (wbapplet->applet, CFG_REVERSE_ORDER, wbp->reverse_order, NULL);
- panel_applet_gconf_set_bool (wbapplet->applet, CFG_SHOW_TOOLTIPS, wbp->show_tooltips, NULL);
- panel_applet_gconf_set_int (wbapplet->applet, CFG_ORIENTATION, wbp->orientation, NULL);
- panel_applet_gconf_set_string (wbapplet->applet, CFG_THEME, wbp->theme, NULL);
+ g_settings_set_boolean (wbapplet->settings, CFG_ONLY_MAXIMIZED, wbp->only_maximized);
+ g_settings_set_boolean (wbapplet->settings, CFG_CLICK_EFFECT, wbp->click_effect);
+ g_settings_set_boolean (wbapplet->settings, CFG_HOVER_EFFECT, wbp->hover_effect);
+ g_settings_set_boolean (wbapplet->settings, CFG_HIDE_ON_UNMAXIMIZED, wbp->hide_on_unmaximized);
+ g_settings_set_boolean (wbapplet->settings, CFG_USE_METACITY_LAYOUT, wbp->use_metacity_layout);
+ g_settings_set_boolean (wbapplet->settings, CFG_REVERSE_ORDER, wbp->reverse_order);
+ g_settings_set_boolean (wbapplet->settings, CFG_SHOW_TOOLTIPS, wbp->show_tooltips);
+ g_settings_set_int (wbapplet->settings, CFG_ORIENTATION, wbp->orientation);
+ g_settings_set_string (wbapplet->settings, CFG_THEME, wbp->theme);
if (!wbp->use_metacity_layout) {
// save only when we're using a custom layout
- panel_applet_gconf_set_string (wbapplet->applet, CFG_BUTTON_LAYOUT, wbp->button_layout, NULL);
+ g_settings_set_string (wbapplet->settings, CFG_BUTTON_LAYOUT, wbp->button_layout);
}
#else
FILE *cfg = g_fopen (g_strconcat(g_get_home_dir(),"/",FILE_CONFIGFILE,NULL),"w");
gint i, j;
-
+
for (i=0; i<WB_BUTTONS; i++) {
fprintf(cfg, "%s %d\n", getCheckBoxCfgKey(i), wbp->button_hidden[i]);
}
@@ -109,7 +107,7 @@ void savePreferences(WBPreferences *wbp, WBApplet *wbapplet) {
if (!wbp->use_metacity_layout) {
fprintf(cfg, "%s %s\n", CFG_BUTTON_LAYOUT, wbp->button_layout);
}
-
+
fclose (cfg);
#endif
}
@@ -130,33 +128,30 @@ WBPreferences *loadPreferences(WBApplet *wbapplet) {
gint j;
for (i=0; i<WB_BUTTONS; i++) {
- wbp->button_hidden[i] = panel_applet_gconf_get_bool(wbapplet->applet, getCheckBoxCfgKey(i),
NULL);
+ wbp->button_hidden[i] = g_settings_get_boolean(wbapplet->settings, getCheckBoxCfgKey(i));
}
-
+
for (i=0; i<WB_IMAGE_STATES; i++) {
for (j=0; j<WB_IMAGES; j++) {
- wbp->images[i][j] = panel_applet_gconf_get_string(wbapplet->applet,
getImageCfgKey(i,j), NULL);
- if (!g_file_test(wbp->images[i][j], G_FILE_TEST_EXISTS | ~G_FILE_TEST_IS_DIR)) { //
this is only good for upgrading where old gconf keys still exist
- wbp->images[i][j] = panel_applet_gconf_get_string(wbapplet->applet,
getImageCfgKey4(i,j), NULL);
- }
+ wbp->images[i][j] = g_settings_get_string(wbapplet->settings, getImageCfgKey(i,j));
}
}
- wbp->only_maximized = panel_applet_gconf_get_bool(wbapplet->applet, CFG_ONLY_MAXIMIZED, NULL);
- wbp->hide_on_unmaximized = panel_applet_gconf_get_bool(wbapplet->applet, CFG_HIDE_ON_UNMAXIMIZED,
NULL);
- wbp->click_effect = panel_applet_gconf_get_bool(wbapplet->applet, CFG_CLICK_EFFECT, NULL);
- wbp->hover_effect = panel_applet_gconf_get_bool(wbapplet->applet, CFG_HOVER_EFFECT, NULL);
- wbp->use_metacity_layout = panel_applet_gconf_get_bool(wbapplet->applet, CFG_USE_METACITY_LAYOUT,
NULL);
- wbp->reverse_order = panel_applet_gconf_get_bool(wbapplet->applet, CFG_REVERSE_ORDER, NULL);
- wbp->show_tooltips = panel_applet_gconf_get_bool(wbapplet->applet, CFG_SHOW_TOOLTIPS, NULL);
- wbp->orientation = panel_applet_gconf_get_int(wbapplet->applet, CFG_ORIENTATION, NULL);
- wbp->theme = panel_applet_gconf_get_string(wbapplet->applet, CFG_THEME, NULL);
-
- // read positions from GConf
+ wbp->only_maximized = g_settings_get_boolean(wbapplet->settings, CFG_ONLY_MAXIMIZED);
+ wbp->hide_on_unmaximized = g_settings_get_boolean(wbapplet->settings, CFG_HIDE_ON_UNMAXIMIZED);
+ wbp->click_effect = g_settings_get_boolean(wbapplet->settings, CFG_CLICK_EFFECT);
+ wbp->hover_effect = g_settings_get_boolean(wbapplet->settings, CFG_HOVER_EFFECT);
+ wbp->use_metacity_layout = g_settings_get_boolean(wbapplet->settings, CFG_USE_METACITY_LAYOUT);
+ wbp->reverse_order = g_settings_get_boolean(wbapplet->settings, CFG_REVERSE_ORDER);
+ wbp->show_tooltips = g_settings_get_boolean(wbapplet->settings, CFG_SHOW_TOOLTIPS);
+ wbp->orientation = g_settings_get_int(wbapplet->settings, CFG_ORIENTATION);
+ wbp->theme = g_settings_get_string(wbapplet->settings, CFG_THEME);
+
+ // read positions from GSettings
if (wbp->use_metacity_layout) {
wbp->button_layout = getMetacityLayout();
} else {
- wbp->button_layout = panel_applet_gconf_get_string(wbapplet->applet, CFG_BUTTON_LAYOUT, NULL);
+ wbp->button_layout = g_settings_get_string(wbapplet->settings, CFG_BUTTON_LAYOUT);
}
#else
FILE *cfg = g_fopen (g_strconcat(g_get_home_dir(),"/",FILE_CONFIGFILE, NULL), "r");
@@ -169,9 +164,6 @@ WBPreferences *loadPreferences(WBApplet *wbapplet) {
for (i=0; i<WB_IMAGE_STATES; i++) {
for (j=0; j<WB_IMAGES; j++) {
wbp->images[i][j] = getCfgValue(cfg,(gchar*)getImageCfgKey(i,j));
- if (!g_file_test(wbp->images[i][j], G_FILE_TEST_EXISTS |
~G_FILE_TEST_IS_DIR)) {
- wbp->images[i][j] = getCfgValue(cfg,(gchar*)getImageCfgKey4(i,j));
- }
}
}
wbp->only_maximized = g_ascii_strtod(getCfgValue(cfg,CFG_ONLY_MAXIMIZED),NULL);
@@ -190,7 +182,7 @@ WBPreferences *loadPreferences(WBApplet *wbapplet) {
}
wbp->theme = getCfgValue(cfg,CFG_THEME);
- fclose (cfg);
+ fclose (cfg);
} else {
// Defaults if the file doesn't exist
@@ -198,7 +190,7 @@ WBPreferences *loadPreferences(WBApplet *wbapplet) {
wbp->hide_on_unmaximized = FALSE;
wbp->click_effect = TRUE;
wbp->hover_effect = TRUE;
- wbp->use_metacity_layout = TRUE;
+ wbp->use_metacity_layout = TRUE;
wbp->reverse_order = FALSE;
wbp->show_tooltips = FALSE;
wbp->orientation = 0;
@@ -230,7 +222,7 @@ WBPreferences *loadPreferences(WBApplet *wbapplet) {
gchar* getCfgValue(FILE *f, gchar *key) {
gchar tmp[256] = {0x0};
long int pos = ftell(f);
-
+
while (f!=NULL && fgets(tmp,sizeof(tmp),f)!=NULL) {
if (g_strrstr(tmp, key))
break;
@@ -244,7 +236,7 @@ gchar* getCfgValue(FILE *f, gchar *key) {
}
#endif
-/* Parses Metacity's GConf entry to get the button order */
+/* Parses Metacity's GSettings entry to get the button order */
gshort *getEBPos(gchar *button_layout) {
gshort *ebps = g_new(gshort, WB_BUTTONS);
gint i, j;
@@ -253,7 +245,7 @@ gshort *getEBPos(gchar *button_layout) {
for (i=0; i<WB_BUTTONS; i++) ebps[i] = i;
if (button_layout == NULL || *button_layout == '\0')
return ebps;
-
+
// for(i=0; i<WB_BUTTONS; i++) ebps[i] = -1; //set to -1 if we don't find some
gchar **pch = g_strsplit_set(button_layout, ":, ", -1);
i = 0; j = 0;
@@ -263,7 +255,7 @@ gshort *getEBPos(gchar *button_layout) {
if (!g_strcmp0(pch[j], "close")) ebps[2] = i++;
j++;
}
-
+
g_strfreev(pch);
return ebps;
}
@@ -333,13 +325,13 @@ void select_new_image (GtkButton *object, gpointer user_data) {
GtkTreeIter iter;
gboolean valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(store), &iter);
while( valid ){
- // do stuff as
+ // do stuff as
gtk_tree_model_get (GTK_TREE_MODEL(store), &iter, ... )
- //
- valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
+ //
+ valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter);
}
*/
-
+
wbapplet->pixbufs = getPixbufs(wbapplet->prefs->images); // reload pixbufs from files
loadThemeButtons(getImageButtons(wbapplet->prefbuilder), wbapplet->pixbufs,
wbapplet->prefs->images); // set pref button images from pixbufs
updateImages(wbapplet); // reload images
@@ -391,7 +383,7 @@ void cb_show_tooltips(GtkButton *button, WBApplet *wbapplet) {
void cb_btn_hidden(GtkButton *button, gpointer user_data) {
CheckBoxData *cbd = (CheckBoxData*)user_data;
WBApplet *wbapplet = cbd->wbapplet;
-
+
if (wbapplet->prefs->button_hidden[cbd->button_id]) {
wbapplet->prefs->button_hidden[cbd->button_id] = 0;
} else {
@@ -405,7 +397,7 @@ void cb_btn_hidden(GtkButton *button, gpointer user_data) {
// "Use Metacity's button order" checkbox
void cb_metacity_layout(GtkButton *button, WBApplet *wbapplet) {
GtkEntry *entry_custom_layout = GTK_ENTRY (gtk_builder_get_object(wbapplet->prefbuilder,
CFG_BUTTON_LAYOUT));
-
+
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(button))) {
wbapplet->prefs->use_metacity_layout = TRUE;
wbapplet->prefs->button_layout = getMetacityLayout();
@@ -418,13 +410,13 @@ void cb_metacity_layout(GtkButton *button, WBApplet *wbapplet) {
}
savePreferences(wbapplet->prefs, wbapplet);
-
+
wbapplet->prefs->eventboxposition = getEBPos(wbapplet->prefs->button_layout);
reloadButtons (wbapplet);
}
// "Reload" button clicked
-void cb_reload_buttons(GtkButton *button, WBApplet *wbapplet) {
+void cb_reload_buttons(GtkButton *button, WBApplet *wbapplet) {
GtkEntry *entry_custom_layout = GTK_ENTRY (gtk_builder_get_object(wbapplet->prefbuilder,
CFG_BUTTON_LAYOUT));
gchar *new_layout = g_strdup(gtk_entry_get_text(entry_custom_layout));
wbapplet->prefs->button_layout = new_layout;
@@ -443,13 +435,13 @@ static void cb_theme_changed(GtkComboBox *combo, WBApplet *wbapplet) {
model = gtk_combo_box_get_model( combo );
gtk_tree_model_get( model, &iter, 0, &theme, -1 );
}
-
+
wbp->theme = theme;
wbp->images = getImages(g_strconcat(PATH_THEMES,"/",wbp->theme,"/",NULL)); // rebuild image paths
wbapplet->pixbufs = getPixbufs(wbp->images); // reload pixbufs from files
loadThemeButtons(getImageButtons(wbapplet->prefbuilder), wbapplet->pixbufs, wbp->images); // set pref
button images from pixbufs
updateImages(wbapplet);
-
+
savePreferences(wbp, wbapplet);
}
@@ -476,11 +468,14 @@ void cb_orientation(GtkRadioButton *style, WBApplet *wbapplet) {
/* The Preferences Dialog */
//void properties_cb(BonoboUIComponent *uic, WBApplet *wbapplet, const char *verb) {
-void properties_cb (GtkAction *action, WBApplet *wbapplet) {
+void properties_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) {
+ WBApplet *wbapplet;
GtkWidget ***btn;
ImageOpenData ***iod;
gint i,j;
+ wbapplet = (WBApplet *) user_data;
+
// Create the Properties dialog from the GtkBuilder file
if (wbapplet->window_prefs) {
// Window already exists, only open
@@ -490,7 +485,7 @@ void properties_cb (GtkAction *action, WBApplet *wbapplet) {
gtk_builder_add_from_file (wbapplet->prefbuilder, PATH_UI_PREFS, NULL);
wbapplet->window_prefs = GTK_WIDGET (gtk_builder_get_object (wbapplet->prefbuilder,
"properties"));
}
-
+
/* Get the widgets from GtkBuilder & Init data structures we'll pass to our buttons */
btn = getImageButtons(wbapplet->prefbuilder);
iod = g_new(ImageOpenData**, WB_IMAGE_STATES);
@@ -506,7 +501,7 @@ void properties_cb (GtkAction *action, WBApplet *wbapplet) {
g_signal_connect(G_OBJECT (btn[i][j]), "clicked", G_CALLBACK (select_new_image),
iod[i][j]);
}
}
-
+
GtkToggleButton
*chkb_only_maximized = GTK_TOGGLE_BUTTON (gtk_builder_get_object(wbapplet->prefbuilder,
CFG_ONLY_MAXIMIZED)),
*chkb_click_effect = GTK_TOGGLE_BUTTON (gtk_builder_get_object(wbapplet->prefbuilder,
CFG_CLICK_EFFECT)),
@@ -520,13 +515,13 @@ void properties_cb (GtkAction *action, WBApplet *wbapplet) {
*btn_reload_order = GTK_BUTTON (gtk_builder_get_object(wbapplet->prefbuilder,
"btn_reload_order")),
*btn_close = GTK_BUTTON (gtk_builder_get_object(wbapplet->prefbuilder, "btn_close"));
GtkEntry *entry_custom_order = GTK_ENTRY (gtk_builder_get_object(wbapplet->prefbuilder,
CFG_BUTTON_LAYOUT));
- GtkComboBox *combo_theme = GTK_COMBO_BOX (gtk_builder_get_object(wbapplet->prefbuilder, CFG_THEME));
+ GtkComboBox *combo_theme = GTK_COMBO_BOX (gtk_builder_get_object(wbapplet->prefbuilder, CFG_THEME));
GtkToggleButton **chkb_btn_hidden = getHideButtons(wbapplet->prefbuilder);
GtkRadioButton **radio_orientation = getOrientationButtons(wbapplet->prefbuilder);
-
+
loadThemeComboBox(combo_theme, wbapplet->prefs->theme);
loadThemeButtons(btn, wbapplet->pixbufs, wbapplet->prefs->images);
-
+
// set the checkboxes according to preferences
gtk_widget_set_sensitive(GTK_WIDGET(entry_custom_order), !wbapplet->prefs->use_metacity_layout);
gtk_toggle_button_set_active (chkb_only_maximized, wbapplet->prefs->only_maximized);
@@ -539,7 +534,7 @@ void properties_cb (GtkAction *action, WBApplet *wbapplet) {
gtk_toggle_button_set_active (chkb_show_tooltips, wbapplet->prefs->show_tooltips);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radio_orientation[wbapplet->prefs->orientation]),
TRUE);
gtk_entry_set_text (entry_custom_order, (const gchar*)wbapplet->prefs->button_layout);
-
+
CheckBoxData **cbd = g_new(CheckBoxData*, WB_BUTTONS);
for (i=0; i<WB_BUTTONS; i++) {
cbd[i] = g_new(CheckBoxData,1);
@@ -549,12 +544,12 @@ void properties_cb (GtkAction *action, WBApplet *wbapplet) {
gtk_toggle_button_set_active (chkb_btn_hidden[i], wbapplet->prefs->button_hidden[i]);
g_signal_connect(G_OBJECT(chkb_btn_hidden[i]), "clicked", G_CALLBACK (cb_btn_hidden), cbd[i]);
}
-
+
for (i=0; i<3; i++)
g_signal_connect(G_OBJECT(radio_orientation[i]), "clicked", G_CALLBACK (cb_orientation),
wbapplet);
g_signal_connect(G_OBJECT(chkb_only_maximized), "clicked", G_CALLBACK (cb_only_maximized), wbapplet);
g_signal_connect(G_OBJECT(chkb_click_effect), "clicked", G_CALLBACK (cb_click_effect), wbapplet);
- g_signal_connect(G_OBJECT(chkb_hover_effect), "clicked", G_CALLBACK (cb_hover_effect), wbapplet);
+ g_signal_connect(G_OBJECT(chkb_hover_effect), "clicked", G_CALLBACK (cb_hover_effect), wbapplet);
g_signal_connect(G_OBJECT(chkb_hide_on_unmaximized), "clicked", G_CALLBACK (cb_hide_on_unmaximized),
wbapplet);
g_signal_connect(G_OBJECT(chkb_hide_decoration), "clicked", G_CALLBACK (cb_hide_decoration),
wbapplet);
g_signal_connect(G_OBJECT(chkb_metacity_order), "clicked", G_CALLBACK (cb_metacity_layout), wbapplet);
@@ -572,4 +567,4 @@ void properties_cb (GtkAction *action, WBApplet *wbapplet) {
void properties_close (GtkButton *object, WBApplet *wbapplet) {
gtk_widget_destroy(wbapplet->window_prefs);
wbapplet->window_prefs = NULL;
-}
+}
\ No newline at end of file
diff --git a/window-buttons/theme.c b/window-buttons/theme.c
old mode 100644
new mode 100755
index 00d8174..8a98679
--- a/window-buttons/theme.c
+++ b/window-buttons/theme.c
@@ -3,7 +3,6 @@
void loadThemeComboBox(GtkComboBox *, gchar *);
void loadThemeButtons(GtkWidget ***, GdkPixbuf ***, gchar ***);
const gchar *getImageCfgKey(gushort, gushort);
-const gchar *getImageCfgKey4(gushort, gushort);
const gchar* getButtonImageState(int, const gchar*);
const gchar* getButtonImageState4(int);
const gchar* getButtonImageName(int);
@@ -47,15 +46,12 @@ const gchar* getButtonImageState4(int state_id) { // old 4-state mode for backwa
/* returns the image key string */
const gchar *getImageCfgKey(gushort image_state, gushort image_index) {
- return g_strconcat("btn_", getButtonImageState(image_state,"_"), "_",
getButtonImageName(image_index), NULL);
-}
-const gchar *getImageCfgKey4(gushort image_state, gushort image_index) { // old 4-state mode for backwards
compatibility
- return g_strconcat("btn_", getButtonImageState4(image_state), "_", getButtonImageName(image_index),
NULL);
+ return g_strconcat("btn-", getButtonImageState(image_state,"-"), "-",
getButtonImageName(image_index), NULL);
}
-/* Load the themes into a combo Box */
-void loadThemeComboBox(GtkComboBox *combo, gchar *active_theme) {
+/* Load the themes into a combo Box */
+void loadThemeComboBox(GtkComboBox *combo, gchar *active_theme) {
GtkTreeIter iter;
GtkListStore *store = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT );
// (0=real_name, 1=display_name, 2=id)
@@ -79,19 +75,19 @@ void loadThemeComboBox(GtkComboBox *combo, gchar *active_theme) {
{
active = N_THEMES;
}
-
+
gtk_list_store_append( store, &iter );
- gtk_list_store_set( store, &iter,
+ gtk_list_store_set( store, &iter,
0, curtheme,
1, fixThemeName(g_strdup(curtheme)),
2, 1+N_THEMES++,
-1 );
}
if (active<0) active = N_THEMES;
-
+
gtk_list_store_append( store, &iter );
gtk_list_store_set( store, &iter, 0,"custom", 1,"Custom", 2,0, -1 );
-
+
gtk_combo_box_set_model( combo, GTK_TREE_MODEL(store) );
g_object_unref( G_OBJECT( store ) );
@@ -159,7 +155,7 @@ gchar *fixThemeName(gchar *theme_name) {
if (prev == '-') theme_name[i] = g_ascii_toupper(theme_name[i]);
prev = theme_name[i];
}
-
+
return theme_name;
} else if (len == 1) {
return g_ascii_strup(theme_name,1);
diff --git a/window-buttons/themes/Makefile.am b/window-buttons/themes/Makefile.am
index db2dd98..284066c 100644
--- a/window-buttons/themes/Makefile.am
+++ b/window-buttons/themes/Makefile.am
@@ -25,67 +25,68 @@ EXTRA_DIST = \
$(blubuntu_DATA)
default_DATA = default/*.png
-defaultdir = $(datadir)/pixmaps/windowbuttons/themes/default
+defaultdir = $(pkgdatadir)/window-buttons-applet/themes/default
dust_DATA = dust/*.png
-dustdir = $(datadir)/pixmaps/windowbuttons/themes/dust
+dustdir = $(pkgdatadir)/window-buttons-applet/themes/dust
human_DATA = human/*.png
-humandir = $(datadir)/pixmaps/windowbuttons/themes/human
+humandir = $(pkgdatadir)/window-buttons-applet/themes/human
human_thin_DATA = human-thin/*.png
-human_thindir = $(datadir)/pixmaps/windowbuttons/themes/human-thin
+human_thindir = $(pkgdatadir)/window-buttons-applet/themes/human-thin
dust_sand_DATA = dust-sand/*.png
-dust_sanddir = $(datadir)/pixmaps/windowbuttons/themes/dust-sand
+dust_sanddir = $(pkgdatadir)/window-buttons-applet/themes/dust-sand
blaze_DATA = blaze/*.png
-blazedir = $(datadir)/pixmaps/windowbuttons/themes/blaze
+blazedir = $(pkgdatadir)/window-buttons-applet/themes/blaze
blaze_color_DATA = blaze-color/*.png
-blaze_colordir = $(datadir)/pixmaps/windowbuttons/themes/blaze-color
+blaze_colordir = $(pkgdatadir)/window-buttons-applet/themes/blaze-color
antique_DATA = antique/*.png
-antiquedir = $(datadir)/pixmaps/windowbuttons/themes/antique
+antiquedir = $(pkgdatadir)/window-buttons-applet/themes/antique
ambiance_DATA = ambiance/*.png
-ambiancedir = $(datadir)/pixmaps/windowbuttons/themes/ambiance
+ambiancedir = $(pkgdatadir)/window-buttons-applet/themes/ambiance
dust_invert_DATA = dust-invert/*.png
-dust_invertdir = $(datadir)/pixmaps/windowbuttons/themes/dust-invert
+dust_invertdir = $(pkgdatadir)/window-buttons-applet/themes/dust-invert
elementary_DATA = elementary/*.png \
elementary/README
-elementarydir = $(datadir)/pixmaps/windowbuttons/themes/elementary
+elementarydir = $(pkgdatadir)/window-buttons-applet/themes/elementary
radiance_DATA = radiance/*.png
-radiancedir = $(datadir)/pixmaps/windowbuttons/themes/radiance
+radiancedir = $(pkgdatadir)/window-buttons-applet/themes/radiance
WoW_DATA = WoW/*.png
-WoWdir = $(datadir)/pixmaps/windowbuttons/themes/WoW
+WoWdir = $(pkgdatadir)/window-buttons-applet/themes/WoW
ambiance_x_studio_DATA = ambiance-x-studio/*.png
-ambiance_x_studiodir = $(datadir)/pixmaps/windowbuttons/themes/ambiance-x-studio
+ambiance_x_studiodir = $(pkgdatadir)/window-buttons-applet/themes/ambiance-x-studio
sorbet_DATA = sorbet/*.png
-sorbetdir = $(datadir)/pixmaps/windowbuttons/themes/sorbet
+sorbetdir = $(pkgdatadir)/window-buttons-applet/themes/sorbet
ambiance_maverick_DATA = ambiance-maverick/*.png
-ambiance_maverickdir = $(datadir)/pixmaps/windowbuttons/themes/ambiance-maverick
+ambiance_maverickdir = $(pkgdatadir)/window-buttons-applet/themes/ambiance-maverick
radiance_maverick_DATA = radiance-maverick/*.png
-radiance_maverickdir = $(datadir)/pixmaps/windowbuttons/themes/radiance-maverick
+radiance_maverickdir = $(pkgdatadir)/window-buttons-applet/themes/radiance-maverick
equinox_glass_DATA = equinox-glass/*.png \
equinox-glass/README
-equinox_glassdir = $(datadir)/pixmaps/windowbuttons/themes/equinox-glass
+equinox_glassdir = $(pkgdatadir)/window-buttons-applet/themes/equinox-glass
plano_DATA = plano/*.png
-planodir = $(datadir)/pixmaps/windowbuttons/themes/plano
+planodir = $(pkgdatadir)/window-buttons-applet/themes/plano
new_hope_DATA = new-hope/*.png
-new_hopedir = $(datadir)/pixmaps/windowbuttons/themes/new-hope
+new_hopedir = $(pkgdatadir)/window-buttons-applet/themes/new-hope
blubuntu_DATA = blubuntu/*.png
-blubuntudir = $(datadir)/pixmaps/windowbuttons/themes/blubuntu
+blubuntudir = $(pkgdatadir)/window-buttons-applet/themes/blubuntu
+-include $(top_srcdir)/git.mk
\ No newline at end of file
diff --git a/window-buttons/windowbuttons.c b/window-buttons/windowbuttons.c
old mode 100644
new mode 100755
index 224c426..ba7a86e
--- a/window-buttons/windowbuttons.c
+++ b/window-buttons/windowbuttons.c
@@ -11,17 +11,17 @@
* 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
*/
-
+
#include "windowbuttons.h"
/* Prototypes */
@@ -33,10 +33,8 @@ static void umaxed_window_state_changed (WnckWindow *, WnckWindowState, WnckWind
static void viewports_changed (WnckScreen *, WBApplet *);
static void window_closed (WnckScreen *, WnckWindow *, WBApplet *);
static void window_opened (WnckScreen *, WnckWindow *, WBApplet *);
-//static void about_cb (BonoboUIComponent *, WBApplet *);
-static void about_cb (GtkAction *, WBApplet *);
-//void properties_cb (BonoboUIComponent *, WBApplet *, const char *);
-void properties_cb (GtkAction *, WBApplet *);
+static void about_cb ( GSimpleAction *, GVariant *, gpointer );
+void properties_cb ( GSimpleAction *, GVariant *, gpointer );
static gboolean hover_enter (GtkWidget *, GdkEventCrossing *, WBApplet *);
static gboolean hover_leave (GtkWidget *, GdkEventCrossing *, WBApplet *);
static gboolean button_press (GtkWidget *, GdkEventButton *, WBApplet *);
@@ -51,7 +49,7 @@ void toggleHidden(WBApplet *);
void savePreferences(WBPreferences *, WBApplet *);
void loadThemes(GtkComboBox *, gchar *);
WBPreferences *loadPreferences(WBApplet *);
-gchar *getButtonLayoutGConf(WBApplet *, gboolean);
+//gchar *getButtonLayoutGConf(WBApplet *, gboolean);
gchar *getMetacityLayout(void);
const gchar *getCheckBoxCfgKey (gushort);
GdkPixbuf ***getPixbufs(gchar ***);
@@ -61,12 +59,20 @@ GdkPixbuf ***getPixbufs(gchar ***);
G_DEFINE_TYPE (WBApplet, wb_applet, PANEL_TYPE_APPLET);
static const gchar windowbuttons_menu_items [] =
- "<menuitem name=\"Preferences\" action=\"WBPreferences\" />"
- "<menuitem name=\"About\" action=\"WBAbout\" />";
-
-static const GtkActionEntry windowbuttons_menu_actions [] = {
- { "WBPreferences", GTK_STOCK_PROPERTIES, N_("_Preferences"), NULL, NULL, G_CALLBACK (properties_cb)
},
- { "WBAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, G_CALLBACK (about_cb) }
+ "<section>"
+ "<item>"
+ "<attribute name=\"label\">Preferences</attribute>"
+ "<attribute name=\"action\">windowbuttons.preferences</attribute>"
+ "</item>"
+ "<item>"
+ "<attribute name=\"label\">About</attribute>"
+ "<attribute name=\"action\">windowbuttons.about</attribute>"
+ "</item>"
+ "</section>";
+
+static const GActionEntry windowbuttons_menu_actions [] = {
+ { "preferences", properties_cb, NULL, NULL, NULL },
+ { "about", about_cb, NULL, NULL, NULL }
};
WBApplet* wb_applet_new (void) {
@@ -83,7 +89,7 @@ static void wb_applet_init(WBApplet *wbapplet) {
/* The About dialog */
//static void about_cb (BonoboUIComponent *uic, WBApplet *applet) {
-static void about_cb (GtkAction *action, WBApplet *applet) {
+static void about_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data) {
static const gchar *authors [] = {
"Andrej Belcijan <{andrejx}at{gmail.com}>",
" ",
@@ -105,7 +111,7 @@ static void about_cb (GtkAction *action, WBApplet *applet) {
"milky2313 for theme \"Sorbet\"",
NULL
};
-
+
const gchar *documenters[] = {
"Andrej Belcijan <{andrejx}at{gmail.com}>",
NULL
@@ -139,7 +145,7 @@ static WnckWindow *getRootWindow (WnckScreen *screen) {
static WnckWindow *getUpperMaximized (WBApplet *wbapplet) {
if (!wbapplet->prefs->only_maximized)
return wbapplet->activewindow;
-
+
GList *windows = wnck_screen_get_windows_stacked(wbapplet->activescreen);
WnckWindow *returnwindow = NULL;
@@ -230,7 +236,7 @@ void updateImages (WBApplet *wbapplet) {
}
toggleHidden(wbapplet);
-
+
//update minimize button:
gtk_image_set_from_pixbuf (wbapplet->button[WB_BUTTON_MINIMIZE]->image,
wbapplet->pixbufs[getImageState(wbapplet->button[WB_BUTTON_MINIMIZE]->state)][WB_IMAGE_MINIMIZE]);
// update maximize/unmaximize button:
@@ -280,7 +286,7 @@ static void active_window_changed (WnckScreen *screen,
WnckWindow *previous,
WBApplet *wbapplet) {
gint i;
-
+
// Start tracking the new active window:
if (wbapplet->activewindow)
if (g_signal_handler_is_connected(G_OBJECT(wbapplet->activewindow), wbapplet->active_handler))
@@ -316,7 +322,7 @@ static void active_window_state_changed (WnckWindow *window,
WnckWindowState new_state,
WBApplet *wbapplet) {
gint i;
-
+
wbapplet->umaxedwindow = getUpperMaximized(wbapplet);
wbapplet->rootwindow = getRootWindow(wbapplet->activescreen);
@@ -331,7 +337,7 @@ static void active_window_state_changed (WnckWindow *window,
}
}
}
-
+
updateImages(wbapplet);
}
@@ -343,7 +349,7 @@ static void umaxed_window_state_changed (WnckWindow *window,
wbapplet->umaxedwindow = getUpperMaximized(wbapplet);
wbapplet->rootwindow = getRootWindow(wbapplet->activescreen);
-
+
updateImages(wbapplet); // need to hide buttons after click if desktop is below
}
@@ -378,11 +384,11 @@ static void active_workspace_changed (WnckScreen *screen,
/* Called when we release the click on a button */
static gboolean button_release (GtkWidget *event_box, GdkEventButton *event, WBApplet *wbapplet) {
-
+
WnckWindow *controlledwindow;
const GdkPixbuf *imgpb;
gint i, imgw, imgh;
-
+
if (event->button != 1) return FALSE;
// Find our button:
@@ -406,7 +412,7 @@ static gboolean button_release (GtkWidget *event_box, GdkEventButton *event, WBA
} else {
controlledwindow = wbapplet->activewindow;
}
-
+
switch (i) {
case WB_BUTTON_MINIMIZE:
wnck_window_minimize(controlledwindow);
@@ -426,7 +432,7 @@ static gboolean button_release (GtkWidget *event_box, GdkEventButton *event, WBA
}
updateImages(wbapplet);
-
+
return TRUE;
}
@@ -435,7 +441,7 @@ static gboolean button_press (GtkWidget *event_box,
GdkEventButton *event,
WBApplet *wbapplet) {
gint i;
-
+
if (event->button != 1) return FALSE;
// Find our button:
@@ -446,7 +452,7 @@ static gboolean button_press (GtkWidget *event_box,
break;
}
}
-
+
updateImages(wbapplet);
}
@@ -461,16 +467,16 @@ static gboolean hover_enter (GtkWidget *widget,
// Find our button:
if (wbapplet->prefs->hover_effect) {
- for (i=0; i<WB_BUTTONS; i++) {
+ for (i=0; i<WB_BUTTONS; i++) {
if (GTK_EVENT_BOX(widget) == wbapplet->button[i]->eventbox) {
wbapplet->button[i]->state |= WB_BUTTON_STATE_HOVERED;
break;
}
}
-
+
updateImages(wbapplet);
}
-
+
return TRUE;
}
@@ -483,12 +489,12 @@ static gboolean hover_leave (GtkWidget *widget,
// Find our button:
if (wbapplet->prefs->hover_effect) {
for (i=0; i<WB_BUTTONS; i++) {
- if (GTK_EVENT_BOX(widget) == wbapplet->button[i]->eventbox) {
+ if (GTK_EVENT_BOX(widget) == wbapplet->button[i]->eventbox) {
wbapplet->button[i]->state &= ~WB_BUTTON_STATE_HOVERED;
break;
}
}
-
+
updateImages(wbapplet);
}
@@ -499,17 +505,17 @@ WindowButton **createButtons (WBApplet *wbapplet) {
WindowButton **button = g_new(WindowButton*, WB_BUTTONS);
gint i;
- for (i=0; i<WB_BUTTONS; i++) {
+ for (i=0; i<WB_BUTTONS; i++) {
button[i] = g_new0(WindowButton, 1);
button[i]->eventbox = GTK_EVENT_BOX(gtk_event_box_new());
button[i]->image = GTK_IMAGE(gtk_image_new());
-
+
// Woohooo! This line eliminates PanelApplet borders - no more workarounds!
gtk_widget_set_can_focus(GTK_WIDGET(button[i]->eventbox), TRUE);
// Toggle tooltips (this is pointless because it is overridden by
gtk_widget_set_tooltip_text())
//gtk_widget_set_has_tooltip (GTK_WIDGET(button[i]->image), wbapplet->prefs->show_tooltips);
-
+
button[i]->state = 0;
button[i]->state |= WB_BUTTON_STATE_FOCUSED;
if (wbapplet->prefs->button_hidden[i]) {
@@ -517,10 +523,10 @@ WindowButton **createButtons (WBApplet *wbapplet) {
} else {
button[i]->state &= ~WB_BUTTON_STATE_HIDDEN;
}
-
+
gtk_container_add (GTK_CONTAINER (button[i]->eventbox), GTK_WIDGET(button[i]->image));
gtk_event_box_set_visible_window (button[i]->eventbox, FALSE);
-
+
// Add hover events to eventboxes:
gtk_widget_add_events (GTK_WIDGET (button[i]->eventbox), GDK_ENTER_NOTIFY_MASK); //add the
"enter" signal
gtk_widget_add_events (GTK_WIDGET (button[i]->eventbox), GDK_LEAVE_NOTIFY_MASK); //add the
"leave" signal
@@ -529,7 +535,7 @@ WindowButton **createButtons (WBApplet *wbapplet) {
g_signal_connect (G_OBJECT (button[i]->eventbox), "button-release-event", G_CALLBACK
(button_release), wbapplet);
g_signal_connect (G_OBJECT (button[i]->eventbox), "button-press-event", G_CALLBACK
(button_press), wbapplet);
g_signal_connect (G_OBJECT (button[i]->eventbox), "enter-notify-event", G_CALLBACK
(hover_enter), wbapplet);
- g_signal_connect (G_OBJECT (button[i]->eventbox), "leave-notify-event", G_CALLBACK
(hover_leave), wbapplet);
+ g_signal_connect (G_OBJECT (button[i]->eventbox), "leave-notify-event", G_CALLBACK
(hover_leave), wbapplet);
}
return button;
@@ -544,7 +550,7 @@ void placeButtons(WBApplet *wbapplet) {
if (wbapplet->prefs->orientation == 1) {
// Horizontal position: The pixmaps need to be rotated to 0° in every case
wbapplet->angle = GDK_PIXBUF_ROTATE_NONE; //0;
- wbapplet->packtype = GTK_PACK_START;
+ wbapplet->packtype = GTK_PACK_START;
gtk_orientable_set_orientation(GTK_ORIENTABLE(wbapplet->box), GTK_ORIENTATION_HORIZONTAL);
} else if (wbapplet->prefs->orientation == 2) {
// Vertical position: The pixmaps need to be rotated to: Left/Down=270°, Right/Up=90°
@@ -576,8 +582,8 @@ void placeButtons(WBApplet *wbapplet) {
if (wbapplet->prefs->reverse_order) {
wbapplet->packtype = (wbapplet->packtype==GTK_PACK_START)?GTK_PACK_END:GTK_PACK_START;
}
-
- // Add eventboxes to box in preferred order
+
+ // Add eventboxes to box in preferred order
for (i=0; i<WB_BUTTONS; i++) {
for (j=0; j<WB_BUTTONS; j++) {
if (wbapplet->prefs->eventboxposition[j] == i) {
@@ -619,7 +625,7 @@ void reloadButtons(WBApplet *wbapplet) {
void applet_change_orient (PanelApplet *panelapplet, PanelAppletOrient orient, WBApplet *wbapplet) {
if (orient != wbapplet->orient) {
wbapplet->orient = orient;
- wbapplet->pixbufs = getPixbufs(wbapplet->prefs->images);
+ wbapplet->pixbufs = getPixbufs(wbapplet->prefs->images);
reloadButtons(wbapplet);
updateImages(wbapplet);
}
@@ -628,8 +634,10 @@ void applet_change_orient (PanelApplet *panelapplet, PanelAppletOrient orient, W
/* Do the actual applet initialization */
static void init_wbapplet(PanelApplet *applet) {
WBApplet *wbapplet = g_new0 (WBApplet, 1);
+ GSimpleActionGroup *action_group;
wbapplet->applet = applet;
+ wbapplet->settings = panel_applet_settings_new (applet, WINDOWBUTTONS_GSCHEMA);
wbapplet->prefs = loadPreferences(wbapplet);
wbapplet->activescreen = wnck_screen_get_default();
wnck_screen_force_update(wbapplet->activescreen);
@@ -642,10 +650,10 @@ static void init_wbapplet(PanelApplet *applet) {
wbapplet->button = createButtons(wbapplet);
wbapplet->orient = panel_applet_get_orient(wbapplet->applet);
wbapplet->pixbufs = getPixbufs(wbapplet->prefs->images);
-
+
// Rotate & place buttons
- placeButtons(wbapplet);
-
+ placeButtons(wbapplet);
+
// Add box to applet
gtk_container_add (GTK_CONTAINER(wbapplet->applet), GTK_WIDGET(wbapplet->box));
@@ -660,16 +668,15 @@ static void init_wbapplet(PanelApplet *applet) {
g_signal_connect(G_OBJECT (wbapplet->applet), "change-orient", G_CALLBACK (applet_change_orient),
wbapplet);
// ???: Is this still necessary?
- wbapplet->active_handler =
+ wbapplet->active_handler =
g_signal_connect(G_OBJECT (wbapplet->activewindow), "state-changed", G_CALLBACK
(active_window_state_changed), wbapplet);
// Setup applet right-click menu
- GtkActionGroup *action_group = gtk_action_group_new ("WindowButtons Applet Actions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (action_group, windowbuttons_menu_actions, G_N_ELEMENTS
(windowbuttons_menu_actions), wbapplet);
- panel_applet_setup_menu (applet, windowbuttons_menu_items, action_group);
- panel_applet_set_background_widget (wbapplet->applet, GTK_WIDGET (wbapplet->applet)); // Automatic
background update
-
+ action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group), windowbuttons_menu_actions,
G_N_ELEMENTS (windowbuttons_menu_actions), wbapplet);
+ panel_applet_setup_menu (applet, windowbuttons_menu_items, action_group, GETTEXT_PACKAGE);
+ gtk_widget_insert_action_group (GTK_WIDGET (wbapplet->applet), "windowbuttons", G_ACTION_GROUP
(action_group));
+
toggleHidden (wbapplet); // Properly hide or show stuff
updateImages (wbapplet);
}
@@ -697,14 +704,13 @@ static gboolean windowbuttons_applet_factory (PanelApplet *applet, const gchar *
g_set_application_name (APPLET_NAME);
panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR);
- panel_applet_add_preferences (applet, GCONF_PREFS, NULL);
-
+
init_wbapplet(applet);
return TRUE;
}
-PANEL_APPLET_OUT_PROCESS_FACTORY (APPLET_OAFIID_FACTORY,
+PANEL_APPLET_IN_PROCESS_FACTORY (APPLET_OAFIID_FACTORY,
PANEL_TYPE_APPLET,
(PanelAppletFactoryCallback) windowbuttons_applet_factory,
NULL)
\ No newline at end of file
diff --git a/window-buttons/windowbuttons.h b/window-buttons/windowbuttons.h
old mode 100644
new mode 100755
index 77d8e08..a5654a2
--- a/window-buttons/windowbuttons.h
+++ b/window-buttons/windowbuttons.h
@@ -11,12 +11,12 @@
* 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
@@ -34,9 +34,7 @@
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n.h>
-#include <gconf/gconf-client.h>
#include <panel-applet.h>
-#include <panel-applet-gconf.h>
#include <gtk/gtk.h>
#if PLAINTEXT_CONFIG == 1
@@ -52,14 +50,11 @@
#define APPLET_NAME "Window Buttons"
#define APPLET_OAFIID "WindowButtonsApplet"
#define APPLET_OAFIID_FACTORY "WindowButtonsAppletFactory"
-#define PATH_BUILDER "/usr/share/gnome-applets/builder"
-#define PATH_MAIN "/usr/share"
-#define PATH_THEMES PATH_MAIN"/pixmaps/windowbuttons/themes"
-#define PATH_UI_PREFS PATH_MAIN"/windowbuttons/windowbuttons.ui"
-#define PATH_LOGO PATH_MAIN"/pixmaps/windowbuttons-applet.png"
+#define PATH_THEMES WB_DATA_DIR"/themes"
+#define PATH_UI_PREFS GTK_BUILDERDIR"/windowbuttons.ui"
+#define PATH_LOGO DATA_DIR"/pixmaps/windowbuttons-applet.png"
#define METACITY_XML "metacity-theme-1.xml"
#define THEME_EXTENSION "png"
-#define GCONF_PREFS "/schemas/apps/windowbuttons-applet/prefs"
#define FILE_CONFIGFILE ".windowbuttons"
/* strings that identify button states and names */
@@ -74,21 +69,22 @@
#define BTN_NAME_MAXIMIZE "maximize"
#define BTN_NAME_UNMAXIMIZE "unmaximize"
-/* Key strings (used by GConf, Plaintext and GtkBuilder .ui file) */
-#define CFG_ONLY_MAXIMIZED "only_maximized"
-#define CFG_HIDE_ON_UNMAXIMIZED "hide_on_unmaximized"
-#define CFG_HIDE_DECORATION "hide_decoration"
-#define CFG_CLICK_EFFECT "click_effect"
-#define CFG_HOVER_EFFECT "hover_effect"
-#define CFG_USE_METACITY_LAYOUT "use_metacity_layout"
-#define CFG_MINIMIZE_HIDDEN "button_minimize_hidden"
-#define CFG_UNMAXIMIZE_HIDDEN "button_maximize_hidden"
-#define CFG_CLOSE_HIDDEN "button_close_hidden"
-#define CFG_BUTTON_LAYOUT "button_layout"
-#define CFG_REVERSE_ORDER "reverse_order"
+/* Key strings (used by GSettings, Plaintext and GtkBuilder .ui file) */
+#define WINDOWBUTTONS_GSCHEMA "org.gnome.gnome-applets.window-buttons"
+#define CFG_ONLY_MAXIMIZED "only-maximized"
+#define CFG_HIDE_ON_UNMAXIMIZED "hide-on-unmaximized"
+#define CFG_HIDE_DECORATION "hide-decoration"
+#define CFG_CLICK_EFFECT "click-effect"
+#define CFG_HOVER_EFFECT "hover-effect"
+#define CFG_USE_METACITY_LAYOUT "use-metacity-layout"
+#define CFG_MINIMIZE_HIDDEN "button-minimize-hidden"
+#define CFG_UNMAXIMIZE_HIDDEN "button-maximize-hidden"
+#define CFG_CLOSE_HIDDEN "button-close-hidden"
+#define CFG_BUTTON_LAYOUT "button-layout"
+#define CFG_REVERSE_ORDER "reverse-order"
#define CFG_ORIENTATION "orientation"
#define CFG_THEME "theme"
-#define CFG_SHOW_TOOLTIPS "show_tooltips"
+#define CFG_SHOW_TOOLTIPS "show-tooltips"
G_BEGIN_DECLS
@@ -126,7 +122,7 @@ typedef enum {
WB_BUTTON_MINIMIZE = 0, // minimize button
WB_BUTTON_UMAXIMIZE, // maximize/unmaximize button
WB_BUTTON_CLOSE, // close button
-
+
WB_BUTTONS // number of buttons
} WindowButtonIndices;
@@ -167,11 +163,12 @@ typedef struct {
/* WBApplet definition (inherits from PanelApplet) */
typedef struct {
PanelApplet *applet; // The actual PanelApplet
-
+ GSettings *settings;
+
/* Widgets */
GtkBox *box; // Main container
GtkWidget *window_prefs; // Preferences window
-
+
/* Variables */
WBPreferences *prefs; // Main preferences
WindowButton **button; // Array of buttons
@@ -182,13 +179,13 @@ typedef struct {
*rootwindow; // Root window (desktop)
gulong active_handler, // activewindow's event handler ID
umaxed_handler; // umaxedwindow's event handler ID
-
+
PanelAppletOrient orient; // Panel orientation
GdkPixbufRotation angle; // Applet angle
GtkPackType packtype; // Packaging direction of buttons
-
+
GdkPixbuf ***pixbufs; // Images in memory
-
+
/* GtkBuilder */
GtkBuilder *prefbuilder;
} WBApplet;
@@ -208,16 +205,16 @@ Applet structure:
Panel
|
- |
+ |
Applet
|
|
_________ Box _________
| | |
- | | |
+ | | |
EventBox[0] EventBox[1] EventBox[2]
| | |
- | | |
+ | | |
Image[0] Image[1] Image[2]
* note that EventBox/Image pairs (buttons) may be positioned in a different order
diff --git a/window-buttons/windowbuttons.ui b/window-buttons/windowbuttons.ui
index e7284fe..304733b 100644
--- a/window-buttons/windowbuttons.ui
+++ b/window-buttons/windowbuttons.ui
@@ -175,7 +175,7 @@ Normal</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_normal_minimize">
+ <object class="GtkButton" id="btn-focused-normal-minimize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -193,7 +193,7 @@ Normal</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_normal_unmaximize">
+ <object class="GtkButton" id="btn-focused-normal-unmaximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -211,7 +211,7 @@ Normal</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_normal_maximize">
+ <object class="GtkButton" id="btn-focused-normal-maximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -229,7 +229,7 @@ Normal</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_normal_close">
+ <object class="GtkButton" id="btn-focused-normal-close">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -273,7 +273,7 @@ Hover</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_clicked_minimize">
+ <object class="GtkButton" id="btn-focused-clicked-minimize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -291,7 +291,7 @@ Hover</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_hover_minimize">
+ <object class="GtkButton" id="btn-focused-hover-minimize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -309,7 +309,7 @@ Hover</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_clicked_unmaximize">
+ <object class="GtkButton" id="btn-focused-clicked-unmaximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -327,7 +327,7 @@ Hover</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_hover_unmaximize">
+ <object class="GtkButton" id="btn-focused-hover-unmaximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -345,7 +345,7 @@ Hover</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_clicked_maximize">
+ <object class="GtkButton" id="btn-focused-clicked-maximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -363,7 +363,7 @@ Hover</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_hover_maximize">
+ <object class="GtkButton" id="btn-focused-hover-maximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -381,7 +381,7 @@ Hover</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_clicked_close">
+ <object class="GtkButton" id="btn-focused-clicked-close">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -399,7 +399,7 @@ Hover</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_focused_hover_close">
+ <object class="GtkButton" id="btn-focused-hover-close">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -430,7 +430,7 @@ Normal</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_normal_minimize">
+ <object class="GtkButton" id="btn-unfocused-normal-minimize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -448,7 +448,7 @@ Normal</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_normal_unmaximize">
+ <object class="GtkButton" id="btn-unfocused-normal-unmaximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -466,7 +466,7 @@ Normal</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_normal_maximize">
+ <object class="GtkButton" id="btn-unfocused-normal-maximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -484,7 +484,7 @@ Normal</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_normal_close">
+ <object class="GtkButton" id="btn-unfocused-normal-close">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -528,7 +528,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_clicked_minimize">
+ <object class="GtkButton" id="btn-unfocused-clicked-minimize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -546,7 +546,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_hover_minimize">
+ <object class="GtkButton" id="btn-unfocused-hover-minimize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -564,7 +564,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_hover_unmaximize">
+ <object class="GtkButton" id="btn-unfocused-hover-unmaximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -582,7 +582,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_clicked_unmaximize">
+ <object class="GtkButton" id="btn-unfocused-clicked-unmaximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -600,7 +600,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_hover_maximize">
+ <object class="GtkButton" id="btn-unfocused-hover-maximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -618,7 +618,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_clicked_maximize">
+ <object class="GtkButton" id="btn-unfocused-clicked-maximize">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -636,7 +636,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_hover_close">
+ <object class="GtkButton" id="btn-unfocused-hover-close">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -654,7 +654,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="btn_unfocused_clicked_close">
+ <object class="GtkButton" id="btn-unfocused-clicked-close">
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
@@ -726,7 +726,7 @@ Clicked</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkCheckButton" id="use_metacity_layout">
+ <object class="GtkCheckButton" id="use-metacity-layout">
<property name="label" translatable="yes">Use Metacity's button
order</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -760,7 +760,7 @@ Clicked</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="button_layout">
+ <object class="GtkEntry" id="button-layout">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes"
comments="Translators: minimize, maximize, close should not be translated">Define your custom order by using
the words:
@@ -799,7 +799,7 @@ Do NOT use double values!</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="reverse_order">
+ <object class="GtkCheckButton" id="reverse-order">
<property name="label" translatable="yes">Reverse order</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1048,7 +1048,7 @@ Do NOT use double values!</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
- <object class="GtkCheckButton" id="only_maximized">
+ <object class="GtkCheckButton" id="only-maximized">
<property name="label" translatable="yes">Control _maximized windows
only</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1064,7 +1064,7 @@ Do NOT use double values!</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="hide_on_unmaximized">
+ <object class="GtkCheckButton" id="hide-on-unmaximized">
<property name="label" translatable="yes">_Hide when no active maximized
window</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1080,7 +1080,7 @@ Do NOT use double values!</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="click_effect">
+ <object class="GtkCheckButton" id="click-effect">
<property name="label" translatable="yes">Enable _click effect</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1096,7 +1096,7 @@ Do NOT use double values!</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="hover_effect">
+ <object class="GtkCheckButton" id="hover-effect">
<property name="label" translatable="yes">Enable _hover effect</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1113,7 +1113,7 @@ Do NOT use double values!</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="show_tooltips">
+ <object class="GtkCheckButton" id="show-tooltips">
<property name="label" translatable="yes">Show _tooltips</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1163,7 +1163,7 @@ Do NOT use double values!</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkCheckButton" id="hide_decoration">
+ <object class="GtkCheckButton" id="hide-decoration">
<property name="label" translatable="yes">Hide Compiz _decorations for
maximized windows</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]