Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Archive
vinagre
Commits
ff250b3e
Commit
ff250b3e
authored
Jul 08, 2009
by
Jonh Wendell
Browse files
more work on plugin stuff
parent
431db3a8
Changes
15
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
ff250b3e
...
...
@@ -134,7 +134,7 @@ AC_SUBST(REBUILD)
#*******************************************************************************
#
dnl active plugins for vinagre.schemas
ACTIVE_PLUGINS="
dummy
"
ACTIVE_PLUGINS="
vnc
"
AC_SUBST(ACTIVE_PLUGINS)
VINAGRE_IMPLIB="-lvinagre-${VINAGRE_API_VERSION}"
...
...
@@ -158,6 +158,7 @@ data/Makefile
data/vinagre.desktop.in
data/vinagre-file.desktop.in
data/vinagre.pc
data/vinagre.schemas.in
data/icons/Makefile
data/pixmaps/Makefile
help/Makefile
...
...
@@ -166,6 +167,7 @@ plugin-loaders/Makefile
plugin-loaders/c/Makefile
plugins/Makefile
plugins/dummy/Makefile
plugins/vnc/Makefile
vinagre/Makefile
vinagre/view/Makefile
])
...
...
data/Makefile.am
View file @
ff250b3e
...
...
@@ -53,7 +53,8 @@ EXTRA_DIST = \
$(desktop_in_files)
\
$(MIMEFILES)
\
$(schemas_in_files)
\
vinagre.pc.in
vinagre.pc.in
\
vinagre.schemas.in.in
if
TELEPATHY
...
...
data/vinagre.schemas.in
→
data/vinagre.schemas.in
.in
View file @
ff250b3e
...
...
@@ -98,5 +98,19 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/vinagre/plugins/active-plugins</key>
<applyto>/apps/vinagre/plugins/active-plugins</applyto>
<owner>vinagre</owner>
<type>list</type>
<list_type>string</list_type>
<default>[@ACTIVE_PLUGINS@]</default>
<locale name="C">
<short>Active plugins</short>
<long>List of active plugins. It contains the "Location" of the active plugins. See the .vinagre-plugin file for obtaining
the "Location" of a given plugin.</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>
plugins/Makefile.am
View file @
ff250b3e
DIST_SUBDIRS
=
\
dummy
dummy
vnc
SUBDIRS
=
\
dummy
dummy
vnc
-include
$(top_srcdir)/git.mk
plugins/vnc/Makefile.am
0 → 100644
View file @
ff250b3e
# vnc plugin
plugindir
=
$(VINAGRE_PLUGINS_LIBS_DIR)
INCLUDES
=
\
-I
$(top_srcdir)
\
$(VINAGRE_CFLAGS)
\
$(WARN_CFLAGS)
\
$(DISABLE_DEPRECATED_CFLAGS)
plugin_LTLIBRARIES
=
libvnc.la
libvnc_la_SOURCES
=
\
vinagre-vnc-plugin.h
\
vinagre-vnc-plugin.c
libvnc_la_LDFLAGS
=
$(PLUGIN_LIBTOOL_FLAGS)
libvnc_la_LIBADD
=
$(VINAGRE_LIBS)
#uidir = $(VINAGRE_PLUGINS_DATA_DIR)/vnc
#ui_DATA = vnc.ui
plugin_in_files
=
vnc.vinagre-plugin.desktop.in
vnc.vinagre-plugin
:
vnc.vinagre-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
plugin_DATA
=
$
(
plugin_in_files:.vinagre-plugin.desktop.in
=
.vinagre-plugin
)
#EXTRA_DIST = $(ui_DATA) $(plugin_in_files)
EXTRA_DIST
=
$(plugin_in_files)
CLEANFILES
=
$(plugin_DATA)
DISTCLEANFILES
=
$(plugin_DATA)
-include
$(top_srcdir)/git.mk
plugins/vnc/vinagre-vnc-plugin.c
0 → 100644
View file @
ff250b3e
/*
* vinagre-vnc-plugin.c
* This file is part of vinagre
*
* Copyright (C) 2009 Jonh Wendell <wendell@bani.com.br>
*
* vinagre-vnc-plugin.c is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* vinagre-vnc-plugin.c is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include
<config.h>
#endif
#include
"vinagre-vnc-plugin.h"
#include
<string.h>
#include
<glib/gi18n-lib.h>
#include
<gmodule.h>
#include
<vinagre/vinagre-debug.h>
#include
<vinagre/vinagre-utils.h>
#define VINAGRE_SORT_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), VINAGRE_TYPE_SORT_PLUGIN, VinagreVncPluginPrivate))
VINAGRE_PLUGIN_REGISTER_TYPE
(
VinagreVncPlugin
,
vinagre_vnc_plugin
)
static
void
impl_activate
(
VinagrePlugin
*
plugin
,
VinagreWindow
*
window
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"VinagreVncPlugin Activate"
);
}
static
void
impl_deactivate
(
VinagrePlugin
*
plugin
,
VinagreWindow
*
window
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"VinagreVncPlugin Deactivate"
);
}
static
void
impl_update_ui
(
VinagrePlugin
*
plugin
,
VinagreWindow
*
window
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"VinagreVncPlugin Update UI"
);
}
static
void
vinagre_vnc_plugin_init
(
VinagreVncPlugin
*
plugin
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"VinagreVncPlugin initializing"
);
}
static
void
vinagre_vnc_plugin_finalize
(
GObject
*
object
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"VinagreVncPlugin finalizing"
);
G_OBJECT_CLASS
(
vinagre_vnc_plugin_parent_class
)
->
finalize
(
object
);
}
static
void
vinagre_vnc_plugin_class_init
(
VinagreVncPluginClass
*
klass
)
{
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
klass
);
VinagrePluginClass
*
plugin_class
=
VINAGRE_PLUGIN_CLASS
(
klass
);
object_class
->
finalize
=
vinagre_vnc_plugin_finalize
;
plugin_class
->
activate
=
impl_activate
;
plugin_class
->
deactivate
=
impl_deactivate
;
plugin_class
->
update_ui
=
impl_update_ui
;
}
/* vim: set ts=8: */
vinagre
/vinagre-plugin
-prefs
.h
→
plugins/vnc
/vinagre-
vnc-
plugin.h
View file @
ff250b3e
/*
* vinagre-plugin
-prefs
.h
* vinagre-
vnc-
plugin.h
* This file is part of vinagre
*
* Copyright (C) 2009 Jorge Pereira <jorge@jorgepereira.com.br>
*
* vinagre-plugin
-prefs
.h is free software: you can redistribute it and/or modify it
* vinagre-
vnc-
plugin.h is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* vinagre-plugin
-prefs
.h is distributed in the hope that it will be useful, but
* vinagre-
vnc-
plugin.h is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
...
...
@@ -18,42 +18,57 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _VINAGRE_PLUGIN_
PREFS_
H_
#define _VINAGRE_PLUGIN_
PREFS_
H_
#ifndef
_
_VINAGRE_
VNC_
PLUGIN_H
_
_
#define
_
_VINAGRE_
VNC_
PLUGIN_H
_
_
#include
<glib.h>
#include
<glib-object.h>
#include
"
vinagre-
window
.h
"
#include
<vinagre/
vinagre-
plugin
.h
>
G_BEGIN_DECLS
#define VINAGRE_TYPE_PLUGIN_PREFS (vinagre_plugin_prefs_get_type ())
#define VINAGRE_PLUGIN_PREFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VINAGRE_TYPE_PLUGIN_PREFS, VinagrePluginPrefs))
#define VINAGRE_PLUGIN_PREFS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VINAGRE_TYPE_PLUGIN_PREFS, VinagrePluginPrefsClass))
#define VINAGRE_IS_PLUGIN_PREFS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VINAGRE_TYPE_PLUGIN_PREFS))
#define VINAGRE_IS_PLUGIN_PREFS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VINAGRE_TYPE_PLUGIN_PREFS))
#define VINAGRE_PLUGIN_PREFS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VINAGRE_TYPE_PLUGIN_PREFS, VinagrePluginPrefsClass))
/*
* Type checking and casting macros
*/
#define VINAGRE_TYPE_SORT_PLUGIN (vinagre_vnc_plugin_get_type ())
#define VINAGRE_SORT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), VINAGRE_TYPE_SORT_PLUGIN, VinagreVncPlugin))
#define VINAGRE_SORT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), VINAGRE_TYPE_SORT_PLUGIN, VinagreVncPluginClass))
#define VINAGRE_IS_SORT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), VINAGRE_TYPE_SORT_PLUGIN))
#define VINAGRE_IS_SORT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), VINAGRE_TYPE_SORT_PLUGIN))
#define VINAGRE_SORT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), VINAGRE_TYPE_SORT_PLUGIN, VinagreVncPluginClass))
/* Private structure type */
typedef
struct
_VinagreVncPluginPrivate
VinagreVncPluginPrivate
;
typedef
struct
_VinagrePluginPrefsClass
VinagrePluginPrefsClass
;
typedef
struct
_VinagrePluginPrefs
VinagrePluginPrefs
;
typedef
struct
_VinagrePluginPrefsPrivate
VinagrePluginPrefsPrivate
;
/*
* Main object structure
*/
typedef
struct
_VinagreVncPlugin
VinagreVncPlugin
;
struct
_VinagrePlugin
PrefsClass
struct
_Vinagre
Vnc
Plugin
{
GObjectClass
parent_class
;
VinagrePlugin
parent_instance
;
};
struct
_VinagrePluginPrefs
/*
* Class definition
*/
typedef
struct
_VinagreVncPluginClass
VinagreVncPluginClass
;
struct
_VinagreVncPluginClass
{
GObject
parent_instance
;
VinagrePluginPrefsPrivate
*
priv
;
VinagrePluginClass
parent_class
;
};
GType
vinagre_plugin_prefs_get_type
(
void
)
G_GNUC_CONST
;
/*
* Public methods
*/
GType
vinagre_vnc_plugin_get_type
(
void
)
G_GNUC_CONST
;
VinagrePluginPrefs
*
vinagre_plugin_prefs_get_default
(
void
);
/* All the plugins must implement this function */
G_MODULE_EXPORT
GType
register_vinagre_plugin
(
GTypeModule
*
module
);
void
vinagre_plugin_prefs_dialog_show
(
VinagreWindow
*
window
);
G_END_DECLS
#endif
/* _VINAGRE_PLUGIN_
PREFS_
H_ */
#endif
/*
_
_VINAGRE_
VNC_
PLUGIN_H
_
_ */
/* vim: set ts=8: */
plugins/vnc/vnc.vinagre-plugin.desktop.in
0 → 100644
View file @
ff250b3e
[Vinagre Plugin]
Module=vnc
IAge=1
_Name=Vnc
_Description=Vnc support
Authors=Jonh Wendell
Copyright=Copyright © 2009 Jonh Wendell
Website=http://www.bani.com.br
Version=1.0
Engine=1
vinagre/vinagre-plugin-info-priv.h
View file @
ff250b3e
...
...
@@ -26,33 +26,33 @@
struct
_VinagrePluginInfo
{
gint
refcount
;
VinagrePlugin
*
plugin
;
gchar
*
file
;
gchar
*
module_name
;
gchar
*
loader
;
gchar
**
dependencies
;
gchar
*
name
;
gchar
*
desc
;
gchar
*
icon_name
;
gchar
**
authors
;
gchar
*
copyright
;
gchar
*
website
;
gchar
*
version
;
/* A plugin is unavailable if it is not possible to activate it
due to an error loading the plugin module (e.g. for Python plugins
when the interpreter has not been correctly initializated) */
gint
available
:
1
;
gint
refcount
;
VinagrePlugin
*
plugin
;
gchar
*
file
;
gchar
*
module_name
;
gchar
*
loader
;
gchar
**
dependencies
;
gchar
*
name
;
gchar
*
desc
;
gchar
*
icon_name
;
gchar
**
authors
;
gchar
*
copyright
;
gchar
*
website
;
gchar
*
version
;
/* A plugin is unavailable if it is not possible to activate it
due to an error loading the plugin module (e.g. for Python plugins
when the interpreter has not been correctly initializated) */
gint
available
:
1
;
gint
engine
:
1
;
};
VinagrePluginInfo
*
_vinagre_plugin_info_new
(
const
gchar
*
file
);
void
_vinagre_plugin_info_ref
(
VinagrePluginInfo
*
info
);
VinagrePluginInfo
*
_vinagre_plugin_info_new
(
const
gchar
*
file
);
void
_vinagre_plugin_info_ref
(
VinagrePluginInfo
*
info
);
void
_vinagre_plugin_info_unref
(
VinagrePluginInfo
*
info
);
#endif
/* __VINAGRE_PLUGIN_INFO_PRIV_H__ */
/* vim: set ts=8: */
vinagre/vinagre-plugin-info.c
View file @
ff250b3e
...
...
@@ -34,42 +34,41 @@
void
_vinagre_plugin_info_ref
(
VinagrePluginInfo
*
info
)
{
g_atomic_int_inc
(
&
info
->
refcount
);
g_atomic_int_inc
(
&
info
->
refcount
);
}
static
VinagrePluginInfo
*
vinagre_plugin_info_copy
(
VinagrePluginInfo
*
info
)
{
_vinagre_plugin_info_ref
(
info
);
return
info
;
_vinagre_plugin_info_ref
(
info
);
return
info
;
}
void
_vinagre_plugin_info_unref
(
VinagrePluginInfo
*
info
)
{
if
(
!
g_atomic_int_dec_and_test
(
&
info
->
refcount
))
return
;
if
(
info
->
plugin
!=
NULL
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Unref plugin %s"
,
info
->
name
);
g_object_unref
(
info
->
plugin
);
}
g_free
(
info
->
file
);
g_free
(
info
->
module_name
);
g_strfreev
(
info
->
dependencies
);
g_free
(
info
->
name
);
g_free
(
info
->
desc
);
g_free
(
info
->
icon_name
);
g_free
(
info
->
website
);
g_free
(
info
->
copyright
);
g_free
(
info
->
loader
);
g_free
(
info
->
version
);
g_strfreev
(
info
->
authors
);
g_free
(
info
);
if
(
!
g_atomic_int_dec_and_test
(
&
info
->
refcount
))
return
;
if
(
info
->
plugin
!=
NULL
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Unref plugin %s"
,
info
->
name
);
g_object_unref
(
info
->
plugin
);
}
g_free
(
info
->
file
);
g_free
(
info
->
module_name
);
g_strfreev
(
info
->
dependencies
);
g_free
(
info
->
name
);
g_free
(
info
->
desc
);
g_free
(
info
->
icon_name
);
g_free
(
info
->
website
);
g_free
(
info
->
copyright
);
g_free
(
info
->
loader
);
g_free
(
info
->
version
);
g_strfreev
(
info
->
authors
);
g_free
(
info
);
}
/**
...
...
@@ -83,15 +82,14 @@ _vinagre_plugin_info_unref (VinagrePluginInfo *info)
GType
vinagre_plugin_info_get_type
(
void
)
{
static
GType
the_type
=
0
;
static
GType
the_type
=
0
;
if
(
G_UNLIKELY
(
!
the_type
))
the_type
=
g_boxed_type_register_static
(
"VinagrePluginInfo"
,
(
GBoxedCopyFunc
)
vinagre_plugin_info_copy
,
(
GBoxedFreeFunc
)
_vinagre_plugin_info_unref
);
if
(
G_UNLIKELY
(
!
the_type
))
the_type
=
g_boxed_type_register_static
(
"VinagrePluginInfo"
,
(
GBoxedCopyFunc
)
vinagre_plugin_info_copy
,
(
GBoxedFreeFunc
)
_vinagre_plugin_info_unref
);
return
the_type
;
return
the_type
;
}
/**
...
...
@@ -105,279 +103,293 @@ vinagre_plugin_info_get_type (void)
VinagrePluginInfo
*
_vinagre_plugin_info_new
(
const
gchar
*
file
)
{
VinagrePluginInfo
*
info
;
GKeyFile
*
plugin_file
=
NULL
;
gchar
*
str
;
g_return_val_if_fail
(
file
!=
NULL
,
NULL
);
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Loading plugin: %s"
,
file
);
info
=
g_new0
(
VinagrePluginInfo
,
1
);
info
->
refcount
=
1
;
info
->
file
=
g_strdup
(
file
);
plugin_file
=
g_key_file_new
();
if
(
!
g_key_file_load_from_file
(
plugin_file
,
file
,
G_KEY_FILE_NONE
,
NULL
))
{
g_warning
(
"Bad plugin file: %s"
,
file
);
goto
error
;
}
if
(
!
g_key_file_has_key
(
plugin_file
,
"Vinagre Plugin"
,
"IAge"
,
NULL
))
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"IAge key does not exist in file: %s"
,
file
);
goto
error
;
}
VinagrePluginInfo
*
info
;
GKeyFile
*
plugin_file
=
NULL
;
gchar
*
str
;
g_return_val_if_fail
(
file
!=
NULL
,
NULL
);
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Loading plugin: %s"
,
file
);
info
=
g_new0
(
VinagrePluginInfo
,
1
);
info
->
refcount
=
1
;
info
->
file
=
g_strdup
(
file
);
plugin_file
=
g_key_file_new
();
if
(
!
g_key_file_load_from_file
(
plugin_file
,
file
,
G_KEY_FILE_NONE
,
NULL
))
{
g_warning
(
"Bad plugin file: %s"
,
file
);
goto
error
;
}
if
(
!
g_key_file_has_key
(
plugin_file
,
"Vinagre Plugin"
,
"IAge"
,
NULL
))
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"IAge key does not exist in file: %s"
,
file
);
goto
error
;
}
/* Check IAge=
2
*/
if
(
g_key_file_get_integer
(
plugin_file
,
"Vinagre Plugin"
,
"IAge"
,
NULL
)
!=
2
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Wrong IAge in file: %s"
,
file
);
goto
error
;
}
/* Check IAge=
1
*/
if
(
g_key_file_get_integer
(
plugin_file
,
"Vinagre Plugin"
,
"IAge"
,
NULL
)
!=
1
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Wrong IAge in file: %s"
,
file
);
goto
error
;
}
/* Get module name */
str
=
g_key_file_get_string
(
plugin_file
,
"Vinagre Plugin"
,
"Module"
,
NULL
);
if
((
str
!=
NULL
)
&&
(
*
str
!=
'\0'
))
{
info
->
module_name
=
str
;
}
else
{
g_warning
(
"Could not find 'Module' in %s"
,
file
);
goto
error
;
}
/* Get the dependency list */
info
->
dependencies
=
g_key_file_get_string_list
(
plugin_file
,
"Vinagre Plugin"
,
"Depends"
,
NULL
,
NULL
);
if
(
info
->
dependencies
==
NULL
)
{
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Could not find 'Depends' in %s"
,
file
);
info
->
dependencies
=
g_new0
(
gchar
*
,
1
);
}
/* Get the loader for this plugin */
str
=
g_key_file_get_string
(
plugin_file
,
"Vinagre Plugin"
,
"Loader"
,
NULL
);
if
((
str
!=
NULL
)
&&
(
*
str
!=
'\0'
))
{
info
->
loader
=
str
;
}
else
{
/* default to the C loader */
info
->
loader
=
g_strdup
(
"c"
);
}
/* Get Name */
str
=
g_key_file_get_locale_string
(
plugin_file
,
"Vinagre Plugin"
,
"Name"
,
NULL
,
NULL
);
if
(
str
)
info
->
name
=
str
;
else
{
g_warning
(
"Could not find 'Name' in %s"
,
file
);
goto
error
;
}
/* Get Description */
str
=
g_key_file_get_locale_string
(
plugin_file
,
"Vinagre Plugin"
,
"Description"
,
NULL
,
NULL
);
if
(
str
)
info
->
desc
=
str
;
else
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Could not find 'Description' in %s"
,
file
);
/* Get Icon */
str
=
g_key_file_get_locale_string
(
plugin_file
,
"Vinagre Plugin"
,
"Icon"
,
NULL
,
NULL
);
if
(
str
)
info
->
icon_name
=
str
;
else
vinagre_debug_message
(
DEBUG_PLUGINS
,
"Could not find 'Icon' in %s, using 'vinagre-plugin'"
,
file
);
/* Get Authors */
info
->
authors
=
g_key_file_get_string_list
(
plugin_file
,
"Vinagre Plugin"
,
"Authors"
,
/* Get module name */
str
=
g_key_file_get_string
(
plugin_file
,
"Vinagre Plugin"
,
"Module"
,
NULL
);
if
((
str
!=
NULL
)
&&
(
*
str
!=
'\0'
))
info
->
module_name
=
str
;
else
{
g_warning
(
"Could not find 'Module' in %s"
,
file
);
goto
error
;
}
/* Get the dependency list */