summaryrefslogtreecommitdiff
path: root/plugins/gnomecompat
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@compiz-fusion.org>2009-03-15 23:41:00 +0100
committerDennis kasprzyk <onestone@compiz-fusion.org>2009-03-15 23:41:00 +0100
commit582a0c71bab4bf6f6020f44fcf6860df29111c25 (patch)
treec6802da1deddcab1f1db7a4a34fa76a699efa772 /plugins/gnomecompat
parentcbc615b856236f4a48cdceb34a7ed4e97818de02 (diff)
downloadmobilebling-582a0c71bab4bf6f6020f44fcf6860df29111c25.tar.gz
mobilebling-582a0c71bab4bf6f6020f44fcf6860df29111c25.tar.bz2
Track core changes.
Use bcop.
Diffstat (limited to 'plugins/gnomecompat')
-rw-r--r--plugins/gnomecompat/gnomecompat.xml.in2
-rw-r--r--plugins/gnomecompat/src/gnomecompat.cpp57
-rw-r--r--plugins/gnomecompat/src/gnomecompat.h20
3 files changed, 14 insertions, 65 deletions
diff --git a/plugins/gnomecompat/gnomecompat.xml.in b/plugins/gnomecompat/gnomecompat.xml.in
index 122bf83..c67021c 100644
--- a/plugins/gnomecompat/gnomecompat.xml.in
+++ b/plugins/gnomecompat/gnomecompat.xml.in
@@ -1,5 +1,5 @@
<compiz>
- <plugin name="gnomecompat">
+ <plugin name="gnomecompat" useBcop="true">
<_short>Gnome Compatibility</_short>
<_long>Options that keep Compiz compatible to the Gnome desktop environment</_long>
<category>General</category>
diff --git a/plugins/gnomecompat/src/gnomecompat.cpp b/plugins/gnomecompat/src/gnomecompat.cpp
index 9912a81..b8b35d5 100644
--- a/plugins/gnomecompat/src/gnomecompat.cpp
+++ b/plugins/gnomecompat/src/gnomecompat.cpp
@@ -25,13 +25,13 @@
#include "gnomecompat.h"
-COMPIZ_PLUGIN_20081216 (gnomecompat, GnomeCompatPluginVTable);
+COMPIZ_PLUGIN_20090315 (gnomecompat, GnomeCompatPluginVTable);
static bool
runCommand (CompAction *action,
CompAction::State state,
CompOption::Vector& options,
- unsigned int commandOption)
+ CompOption *commandOption)
{
Window xid;
@@ -41,7 +41,7 @@ runCommand (CompAction *action,
if (xid != screen->root ())
return false;
- screen->runCommand (gs->opt[commandOption].value ().s ());
+ screen->runCommand (commandOption->value ().s ());
return true;
}
@@ -102,59 +102,25 @@ showRunDialog (CompAction *action,
return true;
}
-#define COMMAND_BIND(opt) \
- boost::bind (runCommand, _1, _2, _3, opt)
-
-static const CompMetadata::OptionInfo gnomeOptionInfo[] = {
- { "main_menu_key", "key", 0, showMainMenu, 0 },
- { "run_key", "key", 0, showRunDialog, 0 },
- { "command_screenshot", "string", 0, 0, 0 },
- { "run_command_screenshot_key", "key", 0,
- COMMAND_BIND (GNOME_OPTION_SCREENSHOT_CMD), 0 },
- { "command_window_screenshot", "string", 0, 0, 0 },
- { "run_command_window_screenshot_key", "key", 0,
- COMMAND_BIND (GNOME_OPTION_WINDOW_SCREENSHOT_CMD), 0 },
- { "command_terminal", "string", 0, 0, 0 },
- { "run_command_terminal_key", "key", 0,
- COMMAND_BIND (GNOME_OPTION_TERMINAL_CMD), 0 }
-};
-
GnomeCompatScreen::GnomeCompatScreen (CompScreen *s) :
PluginClassHandler<GnomeCompatScreen, CompScreen> (s)
{
- if (!gnomecompatVTable->getMetadata ()->initOptions (gnomeOptionInfo,
- GNOME_OPTION_NUM,
- opt))
- {
- setFailed ();
- return;
- }
-
panelActionAtom =
XInternAtom (screen->dpy (), "_GNOME_PANEL_ACTION", FALSE);
panelMainMenuAtom =
XInternAtom (screen->dpy (), "_GNOME_PANEL_ACTION_MAIN_MENU", FALSE);
panelRunDialogAtom =
XInternAtom (screen->dpy (), "_GNOME_PANEL_ACTION_RUN_DIALOG", FALSE);
-}
-CompOption::Vector&
-GnomeCompatScreen::getOptions ()
-{
- return opt;
-}
-
-bool
-GnomeCompatScreen::setOption (const char *name,
- CompOption::Value& value)
-{
- CompOption *o;
+#define COMMAND_BIND(opt) \
+ boost::bind (runCommand, _1, _2, _3, &mOptions[opt])
- o = CompOption::findOption (opt, name, NULL);
- if (!o)
- return false;
+ optionSetMainMenuKeyInitiate (showMainMenu);
+ optionSetRunKeyInitiate (showRunDialog);
+ optionSetRunCommandScreenshotKeyInitiate (COMMAND_BIND (GnomecompatOptions::CommandScreenshot));
+ optionSetRunCommandWindowScreenshotKeyInitiate (COMMAND_BIND (GnomecompatOptions::CommandWindowScreenshot));
+ optionSetRunCommandTerminalKeyInitiate (COMMAND_BIND (GnomecompatOptions::CommandTerminal));
- return CompOption::setOption (*o, value);
}
bool
@@ -163,8 +129,5 @@ GnomeCompatPluginVTable::init ()
if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
return false;
- getMetadata ()->addFromOptionInfo (gnomeOptionInfo, GNOME_OPTION_NUM);
- getMetadata ()->addFromFile (name ());
-
return true;
}
diff --git a/plugins/gnomecompat/src/gnomecompat.h b/plugins/gnomecompat/src/gnomecompat.h
index 156a8f9..f7fc765 100644
--- a/plugins/gnomecompat/src/gnomecompat.h
+++ b/plugins/gnomecompat/src/gnomecompat.h
@@ -26,32 +26,20 @@
#include <core/core.h>
#include <core/pluginclasshandler.h>
-#define GNOME_OPTION_MAIN_MENU_KEY 0
-#define GNOME_OPTION_RUN_DIALOG_KEY 1
-#define GNOME_OPTION_SCREENSHOT_CMD 2
-#define GNOME_OPTION_RUN_SCREENSHOT_KEY 3
-#define GNOME_OPTION_WINDOW_SCREENSHOT_CMD 4
-#define GNOME_OPTION_RUN_WINDOW_SCREENSHOT_KEY 5
-#define GNOME_OPTION_TERMINAL_CMD 6
-#define GNOME_OPTION_RUN_TERMINAL_KEY 7
-#define GNOME_OPTION_NUM 8
+#include "gnomecompat_options.h"
class GnomeCompatScreen :
- public PluginClassHandler<GnomeCompatScreen, CompScreen>
+ public PluginClassHandler<GnomeCompatScreen, CompScreen>,
+ public GnomecompatOptions
{
public:
GnomeCompatScreen (CompScreen *s);
- CompOption::Vector & getOptions ();
- bool setOption (const char *name, CompOption::Value& value);
-
void panelAction (CompOption::Vector& options, Atom action);
Atom panelActionAtom;
Atom panelMainMenuAtom;
Atom panelRunDialogAtom;
-
- CompOption::Vector opt;
};
#define GNOME_SCREEN(s) \
@@ -62,6 +50,4 @@ class GnomeCompatPluginVTable :
{
public:
bool init ();
-
- PLUGIN_OPTION_HELPER (GnomeCompatScreen);
};