extensionSystem: Remove now-unused version_tag, clean up other code as well

https://bugzilla.gnome.org/show_bug.cgi?id=676837
This commit is contained in:
Jasper St. Pierre 2012-03-29 06:32:30 -04:00
parent 12c7cc278d
commit 031206cf1f
3 changed files with 11 additions and 27 deletions

View File

@ -41,7 +41,7 @@
"It can be used only by extensions.gnome.org" "It can be used only by extensions.gnome.org"
#define PLUGIN_MIME_STRING "application/x-gnome-shell-integration::Gnome Shell Integration Dummy Content-Type"; #define PLUGIN_MIME_STRING "application/x-gnome-shell-integration::Gnome Shell Integration Dummy Content-Type";
#define PLUGIN_API_VERSION 3 #define PLUGIN_API_VERSION 4
typedef struct { typedef struct {
GDBusProxy *proxy; GDBusProxy *proxy;
@ -548,11 +548,9 @@ plugin_enable_extension (PluginObject *obj,
static gboolean static gboolean
plugin_install_extension (PluginObject *obj, plugin_install_extension (PluginObject *obj,
NPString uuid, NPString uuid)
NPString version_tag)
{ {
gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length);
gchar *version_tag_str;
if (!uuid_is_valid (uuid_str)) if (!uuid_is_valid (uuid_str))
{ {
@ -560,14 +558,9 @@ plugin_install_extension (PluginObject *obj,
return FALSE; return FALSE;
} }
version_tag_str = g_strndup (version_tag.UTF8Characters,
version_tag.UTF8Length);
g_dbus_proxy_call (obj->proxy, g_dbus_proxy_call (obj->proxy,
"InstallRemoteExtension", "InstallRemoteExtension",
g_variant_new ("(ss)", g_variant_new ("(s)", uuid_str),
uuid_str,
version_tag_str),
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
-1, /* timeout */ -1, /* timeout */
NULL, /* cancellable */ NULL, /* cancellable */
@ -575,7 +568,6 @@ plugin_install_extension (PluginObject *obj,
NULL /* user_data */); NULL /* user_data */);
g_free (uuid_str); g_free (uuid_str);
g_free (version_tag_str);
return TRUE; return TRUE;
} }
@ -804,11 +796,9 @@ plugin_object_invoke (NPObject *npobj,
else if (name == install_extension_id) else if (name == install_extension_id)
{ {
if (!NPVARIANT_IS_STRING(args[0])) return FALSE; if (!NPVARIANT_IS_STRING(args[0])) return FALSE;
if (!NPVARIANT_IS_STRING(args[1])) return FALSE;
return plugin_install_extension (obj, return plugin_install_extension (obj,
NPVARIANT_TO_STRING(args[0]), NPVARIANT_TO_STRING(args[0]));
NPVARIANT_TO_STRING(args[1]));
} }
else if (name == uninstall_extension_id) else if (name == uninstall_extension_id)
{ {

View File

@ -69,18 +69,16 @@ const disconnect = Lang.bind(_signals, _signals.disconnect);
const ENABLED_EXTENSIONS_KEY = 'enabled-extensions'; const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
function installExtensionFromUUID(uuid, version_tag) { function installExtensionFromUUID(uuid) {
let params = { uuid: uuid, let params = { uuid: uuid,
version_tag: version_tag, shell_version: Config.PACKAGE_VERSION };
shell_version: Config.PACKAGE_VERSION,
api_version: API_VERSION.toString() };
let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params); let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params);
_httpSession.queue_message(message, _httpSession.queue_message(message,
function(session, message) { function(session, message) {
let info = JSON.parse(message.response_body.data); let info = JSON.parse(message.response_body.data);
let dialog = new InstallExtensionDialog(uuid, version_tag, info.name); let dialog = new InstallExtensionDialog(uuid, info.name);
dialog.open(global.get_current_time()); dialog.open(global.get_current_time());
}); });
} }
@ -389,11 +387,10 @@ const InstallExtensionDialog = new Lang.Class({
Name: 'InstallExtensionDialog', Name: 'InstallExtensionDialog',
Extends: ModalDialog.ModalDialog, Extends: ModalDialog.ModalDialog,
_init: function(uuid, version_tag, name) { _init: function(uuid, name) {
this.parent({ styleClass: 'extension-dialog' }); this.parent({ styleClass: 'extension-dialog' });
this._uuid = uuid; this._uuid = uuid;
this._version_tag = version_tag;
this._name = name; this._name = name;
this.setButtons([{ label: _("Cancel"), this.setButtons([{ label: _("Cancel"),
@ -434,9 +431,7 @@ const InstallExtensionDialog = new Lang.Class({
_signals.emit('extension-state-changed', state); _signals.emit('extension-state-changed', state);
let params = { version_tag: this._version_tag, let params = { shell_version: Config.PACKAGE_VERSION };
shell_version: Config.PACKAGE_VERSION,
api_version: API_VERSION.toString() };
let url = REPOSITORY_URL_DOWNLOAD.format(this._uuid); let url = REPOSITORY_URL_DOWNLOAD.format(this._uuid);
let message = Soup.form_request_new_from_hash('GET', url, params); let message = Soup.form_request_new_from_hash('GET', url, params);

View File

@ -58,7 +58,6 @@ const GnomeShellIface = <interface name="org.gnome.Shell">
</method> </method>
<method name="InstallRemoteExtension"> <method name="InstallRemoteExtension">
<arg type="s" direction="in" name="uuid"/> <arg type="s" direction="in" name="uuid"/>
<arg type="s" direction="in" name="version"/>
</method> </method>
<method name="UninstallExtension"> <method name="UninstallExtension">
<arg type="s" direction="in" name="uuid"/> <arg type="s" direction="in" name="uuid"/>
@ -254,8 +253,8 @@ const GnomeShell = new Lang.Class({
return extension.errors; return extension.errors;
}, },
InstallRemoteExtension: function(uuid, version_tag) { InstallRemoteExtension: function(uuid) {
ExtensionSystem.installExtensionFromUUID(uuid, version_tag); ExtensionSystem.installExtensionFromUUID(uuid);
}, },
UninstallExtension: function(uuid) { UninstallExtension: function(uuid) {