Commit f18065df authored by Michael Palimaka's avatar Michael Palimaka

Remove support for Google Gadgets.

REVIEW: 109607
parent aee85deb
......@@ -131,13 +131,6 @@ set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configurat
PURPOSE "Needed to build font configuration and installation tools"
)
macro_optional_find_package(Googlegadgets 0.11.0)
set_package_properties(Googlegadgets PROPERTIES DESCRIPTION "Google Gadgets library"
URL "http://code.google.com/p/google-gadgets-for-linux"
TYPE OPTIONAL
PURPOSE "Needed to build plasma scriptengine for google gadgets"
)
#### Python support ( plasma scriptengines ) ####
macro_optional_find_package(PythonLibrary)
set_package_properties(PythonLibrary PROPERTIES DESCRIPTION "Python scripting language"
......
......@@ -4,7 +4,6 @@
# install e.g. FindLibKNotification-1.cmake
set(cmakeFiles FindCkConnector.cmake
FindDBus.cmake
FindGooglegadgets.cmake
FindLibXKlavier.cmake
FindOpenGLES.cmake
FindPAM.cmake
......
# - Try to find Googlegadgets
# Once done this will define
#
# GOOGLEGADGETS_FOUND - system has Googlegadgets
# GOOGLEGADGETS_INCLUDE_DIRS - the Googlegadgets include directory
# GOOGLEGADGETS_LIBRARIES - Link these to use Googlegadgets
# GOOGLEGADGETS_CFLAGS_OTHER - Compiler switches required for using Googlegadgets
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if ( GOOGLEGADGETS_INCLUDE_DIRS )
# in cache already
SET(Googlegadgets_FIND_QUIETLY TRUE)
endif ( GOOGLEGADGETS_INCLUDE_DIRS )
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if( NOT WIN32 )
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(GOOGLEGADGETS QUIET libggadget-1.0>=0.11.0 libggadget-qt-1.0>=0.11.0)
endif( NOT WIN32 )
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Googlegadgets DEFAULT_MSG GOOGLEGADGETS_LIBRARIES GOOGLEGADGETS_INCLUDE_DIRS)
# show the GOOGLEGADGETS_INCLUDE_DIR and GOOGLEGADGETS_LIBRARIES variables only in the advanced view
MARK_AS_ADVANCED(GOOGLEGADGETS_INCLUDE_DIRS GOOGLEGADGETS_LIBRARIES)
......@@ -302,7 +302,7 @@ or desktop. You add &plasma; widgets by simply dragging them where you want them
</screenshot>
The <guibutton>Get New Widgets</guibutton> button allows you to add widgets
you've previously downloaded; and download new &plasma; widgets or google gadgets.
you've previously downloaded and download new &plasma; widgets.
Currently it supports native &plasmagik; packages
and some &Mac; OS&nbsp;X dashboard widgets. Widgets you install this way can then be
accessed just like regular, preinstalled widgets.
......
......@@ -9,7 +9,6 @@ The API of a widget is defined by the host "ScriptEngine", with the exception of
* SuperKaramba's karambas
* Enlightenment 17 edje content
* Google Gadgets
* MacOS dashboard widgets (though not all)
These are loaded via host AppletScriptEngine plugins that bridge between the widget itself and Plasma's canvas.
......
......@@ -29,7 +29,7 @@ Existing constraints/features:
possible problems:
-the API isn't designed for constraints changing at runtime. does anyone think that's likely to matter someday?
-I have no idea how this will affect alien widgets (google gadgets etc). personally I'd be fine with banning those from the screensaver until proper, full security can be implemented.
-I have no idea how this will affect alien widgets. personally I'd be fine with banning those from the screensaver until proper, full security can be implemented.
trust-based security
......
......@@ -7,7 +7,3 @@ endif(QT_QTWEBKIT_FOUND)
if (PYTHONLIBRARY_FOUND AND NOT WIN32)
macro_optional_add_subdirectory(python)
endif (PYTHONLIBRARY_FOUND AND NOT WIN32)
if(GOOGLEGADGETS_FOUND)
macro_optional_add_subdirectory(google_gadgets)
endif(GOOGLEGADGETS_FOUND)
project(plasma-ggl)
if(NOT KDE4_FOUND)
find_package(KDE4 REQUIRED)
find_package(Googlegadgets REQUIRED)
include(KDE4Defaults)
include_directories(
${KDE4_INCLUDES}
)
endif(NOT KDE4_FOUND)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions (${GOOGLEGADGETS_CFLAGS_OTHER})
include_directories(
${GOOGLEGADGETS_INCLUDE_DIRS}
)
execute_process(COMMAND pkg-config --variable=ggl_resource_dir libggadget-1.0
OUTPUT_VARIABLE gadgets_path)
string(REPLACE "\n" "" "gadgets_path" "${gadgets_path}")
# We add our source code here
set(package_SRCS ggl_package.cpp)
set(scriptengine_SRCS
ggl_applet_script.cpp
plasma_host.cpp
plasma_view_host.cpp
panel_decorator.cpp
floating_decorator.cpp
popout_decorator.cpp
)
# Now make sure all files get to the right place
kde4_add_plugin(plasma_package_ggl ${package_SRCS})
target_link_libraries(plasma_package_ggl
${GOOGLEGADGETS_LIBRARIES}
plasma ${KDE4_KDECORE_LIBS} )
kde4_add_plugin(plasma_scriptengine_ggl ${scriptengine_SRCS})
target_link_libraries(plasma_scriptengine_ggl
${GOOGLEGADGETS_LIBRARIES}
plasma ${KDE4_KDEUI_LIBS} )
install(TARGETS plasma_package_ggl DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-packagestructure-googlegadgets.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(TARGETS plasma_scriptengine_ggl DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES plasma-scriptengine-googlegadgets.desktop DESTINATION ${SERVICES_INSTALL_DIR})
#! /usr/bin/env bash
$XGETTEXT *.cpp -o $podir/plasma_appletscriptengine_googlegadget.pot
Build:
=====
To build this package, you need to install the HEAD version of
google-gadgets-for-linux(GGL). Please visit this url for more
information about GGL.
http://code.google.com/p/google-gadgets-for-linux/
To get the lastest version of GGL, please check out the code from svn:
svn checkout http://google-gadgets-for-linux.googlecode.com/svn/trunk/ google-gadgets-for-linux-read-only
/*
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "floating_decorator.h"
#include <QtGui/QMessageBox>
#include <ggadget/gadget_consts.h>
#include <ggadget/gadget.h>
#include <ggadget/messages.h>
#include <ggadget/menu_interface.h>
#include <ggadget/decorated_view_host.h>
#include <ggadget/qt/qt_view_widget.h>
#include <Plasma/Applet>
namespace ggadget {
FloatingDecorator::FloatingDecorator(PlasmaViewHost *host)
: MainViewDecoratorBase(host,
"plasma_floating",
false,
false,
true),
info(host->getInfo()) {
SetButtonVisible(MainViewDecoratorBase::POP_IN_OUT_BUTTON, false);
SetButtonVisible(MainViewDecoratorBase::MENU_BUTTON, false);
SetButtonVisible(MainViewDecoratorBase::CLOSE_BUTTON, false);
}
FloatingDecorator::~FloatingDecorator() {}
void FloatingDecorator::OnAddDecoratorMenuItems(MenuInterface *menu) {
AddCollapseExpandMenuItem(menu);
if (!IsMinimized() && !IsPoppedOut()) {
AddZoomMenuItem(menu);
}
}
bool FloatingDecorator::ShowDecoratedView(bool modal, int flags,
Slot1<bool, int> *feedback_handler) {
info->applet->setMaximumSize(QSizeF());
return MainViewDecoratorBase::ShowDecoratedView(modal, flags, feedback_handler);
}
} // namespace ggadget
/*
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef GGADGET_FLOATING_DECORATOR_H__
#define GGADGET_FLOATING_DECORATOR_H__
#include <ggadget/main_view_decorator_base.h>
#include "plasma_view_host.h"
namespace ggadget {
class FloatingDecorator : public MainViewDecoratorBase {
public:
FloatingDecorator(PlasmaViewHost *host);
virtual ~FloatingDecorator();
virtual void OnAddDecoratorMenuItems(MenuInterface *menu);
virtual bool ShowDecoratedView(bool modal, int flags,
Slot1<bool, int> *feedback_handler);
private:
GadgetInfo *info;
DISALLOW_EVIL_CONSTRUCTORS(FloatingDecorator);
};
} // namespace ggadget
#endif
/*
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "ggl_applet_script.h"
#include <sys/time.h>
#include <time.h>
#include <QtCore/QTimer>
#include <QtCore/QDir>
#include <QtCore/QMutex>
#include <QtCore/QMutexLocker>
#include <QtCore/QFileInfo>
#include <QtGui/QPainter>
#include <QtGui/QColor>
#include <QtGui/QGraphicsSceneMouseEvent>
#include <KDebug>
#include <Plasma/Applet>
#include <Plasma/Package>
#include <ggadget/logger.h>
#include <ggadget/script_runtime_interface.h>
#include <ggadget/qt/qt_view_widget.h>
#include <ggadget/qt/qt_view_host.h>
#include <ggadget/qt/qt_menu.h>
#include <ggadget/qt/utilities.h>
#include <ggadget/qt/qt_main_loop.h>
#include <ggadget/extension_manager.h>
#include <ggadget/script_runtime_manager.h>
#include <ggadget/gadget.h>
#include <ggadget/gadget_consts.h>
#include <ggadget/system_utils.h>
#include <ggadget/host_utils.h>
#include <ggadget/view_interface.h>
#include <ggadget/view.h>
#include <ggadget/host_interface.h>
#include <ggadget/decorated_view_host.h>
#include "plasma_host.h"
#include "ggl_extensions.h"
K_EXPORT_PLASMA_APPLETSCRIPTENGINE(googlegadget, GglAppletScript)
class GglAppletScript::Private {
public:
QString gg_file_;
QString options_;
QMenu menu_;
QStringList errors_;
GadgetInfo info;
~Private() {
// Must set applet to null so other components could know the applet is
// exiting.
info.applet = NULL;
delete info.host;
info.host = NULL;
delete info.gadget;
info.gadget = NULL;
}
};
GglAppletScript::GglAppletScript(QObject *parent, const QVariantList &args)
: Plasma::AppletScript(parent), d(new Private) {
Q_UNUSED(args);
d->info.script = this;
}
GglAppletScript::~GglAppletScript() {
kWarning() << "GGL applet script destroied";
delete d;
}
bool GglAppletScript::init() {
Q_ASSERT(applet());
Q_ASSERT(package());
std::string profile_dir =
ggadget::BuildFilePath(ggadget::GetHomeDirectory().c_str(),
".google/gadgets-plasma", NULL);
QString error;
if (!ggadget::qt::InitGGL(NULL, "ggl-plasma", profile_dir.c_str(),
kGlobalExtensions, 0,
ggadget::qt::GGL_INIT_FLAG_COLLECTOR, &error)) {
kError() << "Failed to init GGL system:" << error;
return false;
}
QFile config_file(package()->path() + "/config.txt");
if (!config_file.open(QIODevice::ReadOnly)) {
kError() << "Failed to open google gadget's config file at "
<< package()->path();
return false;
}
QTextStream in(&config_file);
d->gg_file_ = in.readLine();
d->options_ = in.readLine();
if (d->options_.isNull() || d->options_.isEmpty())
return false;
applet()->setAspectRatioMode(Plasma::ConstrainedSquare);
QTimer::singleShot(50, this, SLOT(loadGadget()));
return true;
}
void GglAppletScript::loadGadget() {
d->errors_.clear();
kDebug() << "Loading gadget " << d->gg_file_
<< "with options " << d->options_;
d->info.location = applet()->location();
d->info.applet = applet();
d->info.host = new ggadget::PlasmaHost(&d->info);
d->info.gadget = d->info.host->LoadGadget(d->gg_file_.toUtf8(),
d->options_.toUtf8(),
0, false);
}
void GglAppletScript::paintInterface(QPainter *p,
const QStyleOptionGraphicsItem *option,
const QRect &contentsRect) {
Q_UNUSED(p);
Q_UNUSED(option);
Q_UNUSED(contentsRect);
#if 0
QRect r = contentsRect;
p->setPen(QColor(0, 0, 255));
p->drawLine(r.left(), r.top(), r.right(), r.bottom());
p->drawLine(r.left(), r.bottom(), r.right(), r.top());
p->drawRect(r);
#endif
}
void GglAppletScript::mousePressEvent(QGraphicsSceneMouseEvent *event) {
// FIXME: AppletScript has no way to handle mousePressEvent right now
if (event->button() == Qt::RightButton) {
kDebug() << "Right button pressed";
d->menu_.clear();
ggadget::qt::QtMenu qt_menu(&d->menu_);
ggadget::ViewInterface *view = d->info.main_view_host->GetViewDecorator();
if (!view->OnAddContextMenuItems(&qt_menu)) {
if (!d->menu_.isEmpty()) {
kDebug() << "Show my own menu";
d->menu_.exec(event->screenPos());
event->accept();
}
}
}
}
QList<QAction*> GglAppletScript::contextualActions() {
d->menu_.clear();
if (d->info.main_view_host) {
ggadget::ViewInterface *view = d->info.main_view_host->GetViewDecorator();
if (view) {
ggadget::qt::QtMenu qt_menu(&d->menu_);
view->OnAddContextMenuItems(&qt_menu);
}
}
return d->menu_.actions();
}
void GglAppletScript::constraintsEvent(Plasma::Constraints constraints) {
if (d->info.host)
d->info.host->onConstraintsEvent(constraints);
}
void GglAppletScript::showConfigurationInterface() {
if (d->info.gadget)
d->info.gadget->ShowOptionsDialog();
}
#include "ggl_applet_script.moc"
/*
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef GGADGET_GGL_APPLET_SCRIPT_H__
#define GGADGET_GGL_APPLET_SCRIPT_H__
#include <Plasma/AppletScript>
namespace ggadget {
class Gadget;
class PlasmaHost;
class DecoratedViewHost;
class ViewHostInterface;
namespace qt {
class QtViewWidget;
}
}
namespace Plasma {
class Applet;
}
class QGraphicsProxyWidget;
class GadgetInfo {
public:
GadgetInfo()
: host(NULL),
gadget(NULL),
applet(NULL),
script(NULL),
proxy(NULL),
main_view_widget(NULL),
main_view_host(NULL),
expanded_main_view_host(NULL),
details_view_host(NULL),
options_view_host(NULL),
view_debug_mode(0),
location(Plasma::Floating)
{}
ggadget::PlasmaHost *host;
ggadget::Gadget *gadget;
Plasma::Applet *applet;
Plasma::AppletScript *script;
QGraphicsProxyWidget *proxy;
ggadget::qt::QtViewWidget *main_view_widget;
ggadget::DecoratedViewHost *main_view_host;
ggadget::ViewHostInterface *expanded_main_view_host;
ggadget::ViewHostInterface *details_view_host;
ggadget::ViewHostInterface *options_view_host;
int view_debug_mode;
Plasma::Location location;
};
class GglAppletScript : public Plasma::AppletScript {
Q_OBJECT
public:
GglAppletScript(QObject *parent, const QVariantList &args);
virtual ~GglAppletScript();
virtual bool init();
virtual void constraintsEvent(Plasma::Constraints constraints);
virtual void paintInterface(QPainter *painter,
const QStyleOptionGraphicsItem *option,
const QRect &contentsRect);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual QList<QAction*> contextualActions();
public Q_SLOTS:
virtual void showConfigurationInterface();
private Q_SLOTS:
void loadGadget();
private:
class Private;
Private *const d;
};
#endif
/*
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef GGADGET_GGL_EXTENSIONS_H
#define GGADGET_GGL_EXTENSIONS_H
// Extensions that should be loaded by ggl system
static const char *kGlobalExtensions[] = {
"default-framework",
"libxml2-xml-parser",
"dbus-script-class",
"default-options",
"qtwebkit-browser-element",
"qt-system-framework",
"qt-edit-element",
// "phonon-audio-framework",
"gst-audio-framework",
"gst-video-element",
"linux-system-framework",
"qt-xml-http-request",
"google-gadget-manager",
"analytics-usage-collector",
"smjs-script-runtime",
"qt-script-runtime",
NULL
};
#endif