summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse van den Kieboom <jesse@icecrew.nl>2010-08-22 21:53:12 (GMT)
committerJesse van den Kieboom <jesse@icecrew.nl>2010-08-22 21:53:12 (GMT)
commitc076c5118f4b3e50c07b022e05da38b31e284006 (patch)
treedbac2cca1ac8cdb33f7e8a1579b893fddc8b1712
parent39f6912abfc31227aad60a9e523c4610029e5e1b (diff)
downloadgedit-collaboration-c076c5118f4b3e50c07b022e05da38b31e284006.tar.gz
gedit-collaboration-c076c5118f4b3e50c07b022e05da38b31e284006.tar.xz
Port to gtk+3/libpeas/gedit-3
-rw-r--r--INSTALL97
-rw-r--r--configure.ac53
-rw-r--r--data/Makefile.am26
-rw-r--r--data/org.gnome.gedit.plugins.collaboration.gschema.xml.in.in18
-rw-r--r--src/collaboration.gedit-plugin.desktop.in.in2
-rw-r--r--src/gedit-collaboration-bookmark-dialog.c21
-rw-r--r--src/gedit-collaboration-bookmark-dialog.h16
-rw-r--r--src/gedit-collaboration-bookmark.c16
-rw-r--r--src/gedit-collaboration-bookmark.h22
-rw-r--r--src/gedit-collaboration-bookmarks.c17
-rw-r--r--src/gedit-collaboration-bookmarks.h20
-rw-r--r--src/gedit-collaboration-color-button.c70
-rw-r--r--src/gedit-collaboration-color-button.h20
-rw-r--r--src/gedit-collaboration-configuration.ui143
-rw-r--r--src/gedit-collaboration-document-message.c20
-rw-r--r--src/gedit-collaboration-document-message.h8
-rw-r--r--src/gedit-collaboration-hue-renderer.c16
-rw-r--r--src/gedit-collaboration-hue-renderer.h20
-rw-r--r--src/gedit-collaboration-manager.c32
-rw-r--r--src/gedit-collaboration-manager.h8
-rw-r--r--src/gedit-collaboration-plugin.c269
-rw-r--r--src/gedit-collaboration-plugin.h17
-rw-r--r--src/gedit-collaboration-undo-manager.c24
-rw-r--r--src/gedit-collaboration-undo-manager.h20
-rw-r--r--src/gedit-collaboration-user-store.c16
-rw-r--r--src/gedit-collaboration-user-store.h20
-rw-r--r--src/gedit-collaboration-user.c205
-rw-r--r--src/gedit-collaboration-window-helper-private.h2
-rw-r--r--src/gedit-collaboration-window-helper.c84
-rw-r--r--src/gedit-collaboration-window-helper.h27
30 files changed, 757 insertions, 572 deletions
diff --git a/INSTALL b/INSTALL
index 2550dab..7d1c323 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,8 +4,10 @@ Installation Instructions
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
- This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
Basic Installation
==================
@@ -13,7 +15,11 @@ Basic Installation
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -42,7 +48,7 @@ may remove or edit it.
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
-The simplest way to compile this package is:
+ The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
- the package.
+ the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
@@ -67,8 +83,15 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
- 6. Often, you can also type `make uninstall' to remove the installed
- files again.
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
Compilers and Options
=====================
@@ -93,7 +116,8 @@ same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
@@ -120,7 +144,8 @@ Installation Names
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
@@ -131,15 +156,46 @@ Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-Optional Features
-=================
-
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -152,6 +208,13 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
Particular systems
==================
@@ -288,7 +351,7 @@ operates.
`configure' can determine that directory automatically.
`--prefix=DIR'
- Use DIR as the installation prefix. *Note Installation Names::
+ Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
diff --git a/configure.ac b/configure.ac
index 8beeba7..6eca13b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,6 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_CONFIG_HEADERS([config.h])
AC_DISABLE_STATIC
-AC_PATH_PROG(GCONFTOOL, gconftool-2)
IT_PROG_INTLTOOL([0.35.0])
AC_PROG_LIBTOOL
@@ -25,7 +24,7 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
-# make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
+dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")
dnl check for win32 platform
@@ -42,44 +41,43 @@ esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
-# ================================================================
-# Gettext stuff.
-# ================================================================
+dnl ================================================================
+dnl Gettext stuff.
+dnl ================================================================
GETTEXT_PACKAGE=geditcollaboration
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
AM_GLIB_GNU_GETTEXT
-# ================================================================
-# Start of pkg-config checks
-# ================================================================
-GEDIT_REQUIRED_VERSION=2.28.0
+dnl ================================================================
+dnl Start of pkg-config checks
+dnl ================================================================
+GEDIT_REQUIRED_VERSION=2.90
INFINITY_REQUIRED_VERSION=0.4.1
PKG_CHECK_MODULES(GEDIT, [
- gedit-2.20 >= $GEDIT_REQUIRED_VERSION,
- gtk+-2.0 >= 2.18
- gconf-2.0 >= 1.1.11
- libinfinity-0.4 >= $INFINITY_REQUIRED_VERSION
- libinfgtk-0.4 >= $INFINITY_REQUIRED_VERSION
- libinftextgtk-0.4 >= $INFINITY_REQUIRED_VERSION
+ gedit >= $GEDIT_REQUIRED_VERSION,
+ gtk+-3.0 >= 2.90.0
+ libinfinity-0.5 >= $INFINITY_REQUIRED_VERSION
+ libinfgtk-0.5 >= $INFINITY_REQUIRED_VERSION
+ libinftextgtk-0.5 >= $INFINITY_REQUIRED_VERSION
libxml-2.0
])
-PKG_CHECK_MODULES(GEDITDEV, [gedit-2.20 >= 2.29.5], [geditdev=yes], [geditdev=no])
-
-if test "$geditdev" = no; then
- AC_SUBST(GEDIT_STABLE)
- AC_DEFINE_UNQUOTED(GEDIT_STABLE,$GEDIT_STABLE, [gedit stable version])
+if test "$USE_MAINTAINER_MODE" = "yes"; then
+ GEDIT_CFLAGS="$GEDIT_CFLAGS -Wall -Werror"
fi
+dnl ================================================================
+dnl GSettings stuff
+dnl ================================================================
-AM_GCONF_SOURCE_2
+GLIB_GSETTINGS
-# ================================================================
-# Misc
-# ================================================================
+dnl ================================================================
+dnl Misc
+dnl ================================================================
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
if test "$platform_win32" = yes; then
@@ -89,10 +87,10 @@ else
fi
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
-GEDIT_PLUGINS_LIBS_DIR="$libdir/gedit-2/plugins"
+GEDIT_PLUGINS_LIBS_DIR="$libdir/gedit/plugins"
AC_SUBST(GEDIT_PLUGINS_LIBS_DIR)
-GEDIT_PLUGINS_DATA_DIR="$datadir/gedit-2/plugins"
+GEDIT_PLUGINS_DATA_DIR="$datadir/gedit/plugins"
AC_SUBST(GEDIT_PLUGINS_DATA_DIR)
AC_CONFIG_FILES([
@@ -101,6 +99,7 @@ data/Makefile
src/Makefile
src/collaboration.gedit-plugin.desktop.in
po/Makefile.in
+data/org.gnome.gedit.plugins.collaboration.gschema.xml.in
])
AC_OUTPUT
@@ -114,7 +113,7 @@ Configuration:
Prefix: ${prefix}
Stable: ${geditdev}
-Note: you have to install these plugins into the same prefix as your gedit
+Note: you have to install this plugin into the same prefix as your gedit
installation (probably /usr if you're using your distro packages, /usr/local
if you have compiled it on your own).
"
diff --git a/data/Makefile.am b/data/Makefile.am
index 97ec743..58ae392 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,27 +1,21 @@
iconsdir = $(GEDIT_PLUGINS_DATA_DIR)/collaboration/icons
icons_DATA = people.svg
-schemasdir = $(GCONF_SCHEMA_FILE_DIR)
-schemas_in_files = gedit-collaboration.schemas.in
-schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
-@INTLTOOL_SCHEMAS_RULE@
+gsettings_SCHEMAS = org.gnome.gedit.plugins.collaboration.gschema.xml
+@INTLTOOL_XML_NOMERGE_RULE@
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schemas_DATA) ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/data/$$p ; \
- done \
- fi
-else
-install-data-local:
-endif
+@GSETTINGS_RULES@
EXTRA_DIST = \
$(icons_DATA) \
- $(schemas_in_files)
+ org.gnome.gedit.plugins.collaboration.gschema.xml.in.in
CLEANFILES = \
- $(schemas_DATA)
+ $(gsettings_SCHEMAS)
+
+DISTCLEANFILES = \
+ $(gsettings_SCHEMAS)
+
+MAINTAINERCLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
-include $(top_srcdir)/git.mk
diff --git a/data/org.gnome.gedit.plugins.collaboration.gschema.xml.in.in b/data/org.gnome.gedit.plugins.collaboration.gschema.xml.in.in
new file mode 100644
index 0000000..09bda0b
--- /dev/null
+++ b/data/org.gnome.gedit.plugins.collaboration.gschema.xml.in.in
@@ -0,0 +1,18 @@
+<schemalist>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gedit.plugins.collaboration" path="/apps/gedit/plugins/collaboration/">
+ <child schema="org.gnome.gedit.plugins.collaboration.user" name="user"/>
+ </schema>
+
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gedit.plugins.collaboration.user" path="/apps/gedit-plugins/collaboration/user/">
+ <key name="name" type="s">
+ <default>""</default>
+ <_summary>Default User Name</_summary>
+ <_description>The default user name for collaboration</_description>
+ </key>
+ <key name="hue" type="d">
+ <default>-1</default>
+ <_summary>Default User Hue</_summary>
+ <_description>The default user hue part of the color to identify the user by.</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/src/collaboration.gedit-plugin.desktop.in.in b/src/collaboration.gedit-plugin.desktop.in.in
index b182f4e..e697873 100644
--- a/src/collaboration.gedit-plugin.desktop.in.in
+++ b/src/collaboration.gedit-plugin.desktop.in.in
@@ -1,6 +1,6 @@
[Gedit Plugin]
Module=collaboration
-IAge=2
+IAge=3
_Name=Collaboration
_Description=Collaboration plugin
Authors=Jesse van den Kieboom <jessevdk@gnome.org>
diff --git a/src/gedit-collaboration-bookmark-dialog.c b/src/gedit-collaboration-bookmark-dialog.c
index 35c9f5d..6f3bf5f 100644
--- a/src/gedit-collaboration-bookmark-dialog.c
+++ b/src/gedit-collaboration-bookmark-dialog.c
@@ -5,7 +5,6 @@
#include "gedit-collaboration.h"
#include <config.h>
-#include <gedit/gedit-plugin.h>
#include <glib/gi18n-lib.h>
#include "gedit-collaboration-color-button.h"
@@ -26,10 +25,11 @@ struct _GeditCollaborationBookmarkDialogPrivate
static void buildable_iface_init (GtkBuildableIface *iface);
-GEDIT_PLUGIN_DEFINE_TYPE_WITH_CODE (GeditCollaborationBookmarkDialog, \
- gedit_collaboration_bookmark_dialog, \
- GTK_TYPE_DIALOG,\
- G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init));
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditCollaborationBookmarkDialog,
+ gedit_collaboration_bookmark_dialog,
+ GTK_TYPE_DIALOG,
+ 0,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init));
static GtkBuildableIface parent_iface;
@@ -185,6 +185,11 @@ gedit_collaboration_bookmark_dialog_class_init (GeditCollaborationBookmarkDialog
}
static void
+gedit_collaboration_bookmark_dialog_class_finalize (GeditCollaborationBookmarkDialogClass *klass)
+{
+}
+
+static void
gedit_collaboration_bookmark_dialog_init (GeditCollaborationBookmarkDialog *self)
{
self->priv = GEDIT_COLLABORATION_BOOKMARK_DIALOG_GET_PRIVATE (self);
@@ -281,3 +286,9 @@ gedit_collaboration_bookmark_dialog_new (const gchar *data_dir,
return ret;
}
+
+void
+_gedit_collaboration_bookmark_dialog_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_bookmark_dialog_register_type (type_module);
+}
diff --git a/src/gedit-collaboration-bookmark-dialog.h b/src/gedit-collaboration-bookmark-dialog.h
index 395ca29..73a60c8 100644
--- a/src/gedit-collaboration-bookmark-dialog.h
+++ b/src/gedit-collaboration-bookmark-dialog.h
@@ -8,30 +8,32 @@
G_BEGIN_DECLS
-#define GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG (gedit_collaboration_bookmark_dialog_get_type ())
-#define GEDIT_COLLABORATION_BOOKMARK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG, GeditCollaborationBookmarkDialog))
+#define GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG (gedit_collaboration_bookmark_dialog_get_type ())
+#define GEDIT_COLLABORATION_BOOKMARK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG, GeditCollaborationBookmarkDialog))
#define GEDIT_COLLABORATION_BOOKMARK_DIALOG_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG, GeditCollaborationBookmarkDialog const))
#define GEDIT_COLLABORATION_BOOKMARK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG, GeditCollaborationBookmarkDialogClass))
-#define GEDIT_COLLABORATION_IS_BOOKMARK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG))
+#define GEDIT_COLLABORATION_IS_BOOKMARK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG))
#define GEDIT_COLLABORATION_IS_BOOKMARK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG))
#define GEDIT_COLLABORATION_BOOKMARK_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK_DIALOG, GeditCollaborationBookmarkDialogClass))
-typedef struct _GeditCollaborationBookmarkDialog GeditCollaborationBookmarkDialog;
+typedef struct _GeditCollaborationBookmarkDialog GeditCollaborationBookmarkDialog;
typedef struct _GeditCollaborationBookmarkDialogClass GeditCollaborationBookmarkDialogClass;
typedef struct _GeditCollaborationBookmarkDialogPrivate GeditCollaborationBookmarkDialogPrivate;
-struct _GeditCollaborationBookmarkDialog {
+struct _GeditCollaborationBookmarkDialog
+{
GtkDialog parent;
GeditCollaborationBookmarkDialogPrivate *priv;
};
-struct _GeditCollaborationBookmarkDialogClass {
+struct _GeditCollaborationBookmarkDialogClass
+{
GtkDialogClass parent_class;
};
-GType gedit_collaboration_bookmark_dialog_register_type (GTypeModule *module);
GType gedit_collaboration_bookmark_dialog_get_type (void) G_GNUC_CONST;
+void _gedit_collaboration_bookmark_dialog_register_type (GTypeModule *module);
GtkWidget *gedit_collaboration_bookmark_dialog_new (const gchar *data_dir,
GeditCollaborationBookmark *bookmark);
diff --git a/src/gedit-collaboration-bookmark.c b/src/gedit-collaboration-bookmark.c
index 77427ec..80c311a 100644
--- a/src/gedit-collaboration-bookmark.c
+++ b/src/gedit-collaboration-bookmark.c
@@ -1,7 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include "gedit-collaboration-bookmark.h"
-#include <gedit/gedit-plugin.h>
#include "gedit-collaboration.h"
#define GEDIT_COLLABORATION_BOOKMARK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmarkPrivate))
@@ -24,7 +23,9 @@ enum {
PROP_USER
};
-GEDIT_PLUGIN_DEFINE_TYPE (GeditCollaborationBookmark, gedit_collaboration_bookmark, G_TYPE_OBJECT)
+G_DEFINE_DYNAMIC_TYPE (GeditCollaborationBookmark,
+ gedit_collaboration_bookmark,
+ G_TYPE_OBJECT)
static void
gedit_collaboration_bookmark_finalize (GObject *object)
@@ -170,6 +171,11 @@ gedit_collaboration_bookmark_class_init (GeditCollaborationBookmarkClass *klass)
}
static void
+gedit_collaboration_bookmark_class_finalize (GeditCollaborationBookmarkClass *klass)
+{
+}
+
+static void
gedit_collaboration_bookmark_init (GeditCollaborationBookmark *self)
{
self->priv = GEDIT_COLLABORATION_BOOKMARK_GET_PRIVATE (self);
@@ -237,3 +243,9 @@ gedit_collaboration_bookmark_get_user (GeditCollaborationBookmark *bookmark)
g_return_val_if_fail (GEDIT_COLLABORATION_IS_BOOKMARK (bookmark), NULL);
return bookmark->priv->user;
}
+
+void
+_gedit_collaboration_bookmark_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_bookmark_register_type (type_module);
+}
diff --git a/src/gedit-collaboration-bookmark.h b/src/gedit-collaboration-bookmark.h
index 75f8afc..dc71a4d 100644
--- a/src/gedit-collaboration-bookmark.h
+++ b/src/gedit-collaboration-bookmark.h
@@ -8,30 +8,32 @@
G_BEGIN_DECLS
-#define GEDIT_COLLABORATION_TYPE_BOOKMARK (gedit_collaboration_bookmark_get_type ())
-#define GEDIT_COLLABORATION_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmark))
-#define GEDIT_COLLABORATION_BOOKMARK_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmark const))
-#define GEDIT_COLLABORATION_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmarkClass))
-#define GEDIT_COLLABORATION_IS_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK))
+#define GEDIT_COLLABORATION_TYPE_BOOKMARK (gedit_collaboration_bookmark_get_type ())
+#define GEDIT_COLLABORATION_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmark))
+#define GEDIT_COLLABORATION_BOOKMARK_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmark const))
+#define GEDIT_COLLABORATION_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmarkClass))
+#define GEDIT_COLLABORATION_IS_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK))
#define GEDIT_COLLABORATION_IS_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_COLLABORATION_TYPE_BOOKMARK))
-#define GEDIT_COLLABORATION_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmarkClass))
+#define GEDIT_COLLABORATION_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARK, GeditCollaborationBookmarkClass))
-typedef struct _GeditCollaborationBookmark GeditCollaborationBookmark;
+typedef struct _GeditCollaborationBookmark GeditCollaborationBookmark;
typedef struct _GeditCollaborationBookmarkClass GeditCollaborationBookmarkClass;
typedef struct _GeditCollaborationBookmarkPrivate GeditCollaborationBookmarkPrivate;
-struct _GeditCollaborationBookmark {
+struct _GeditCollaborationBookmark
+{
GObject parent;
GeditCollaborationBookmarkPrivate *priv;
};
-struct _GeditCollaborationBookmarkClass {
+struct _GeditCollaborationBookmarkClass
+{
GObjectClass parent_class;
};
-GType gedit_collaboration_bookmark_register_type (GTypeModule *module);
GType gedit_collaboration_bookmark_get_type (void) G_GNUC_CONST;
+void _gedit_collaboration_bookmark_register_type (GTypeModule *module);
GeditCollaborationBookmark *gedit_collaboration_bookmark_new (void);
diff --git a/src/gedit-collaboration-bookmarks.c b/src/gedit-collaboration-bookmarks.c
index 617ba24..d490289 100644
--- a/src/gedit-collaboration-bookmarks.c
+++ b/src/gedit-collaboration-bookmarks.c
@@ -2,7 +2,6 @@
#include "gedit-collaboration-bookmarks.h"
-#include <gedit/gedit-plugin.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
@@ -38,8 +37,9 @@ enum
static guint bookmarks_signals[NUM_SIGNALS] = {0,};
static GeditCollaborationBookmarks *bookmarks_default;
-GEDIT_PLUGIN_DEFINE_TYPE (GeditCollaborationBookmarks, gedit_collaboration_bookmarks, \
- G_TYPE_OBJECT)
+G_DEFINE_DYNAMIC_TYPE (GeditCollaborationBookmarks,
+ gedit_collaboration_bookmarks,
+ G_TYPE_OBJECT)
static void
save_bookmark_property (xmlDocPtr doc,
@@ -406,6 +406,11 @@ gedit_collaboration_bookmarks_class_init (GeditCollaborationBookmarksClass *klas
}
static void
+gedit_collaboration_bookmarks_class_finalize (GeditCollaborationBookmarksClass *klass)
+{
+}
+
+static void
gedit_collaboration_bookmarks_init (GeditCollaborationBookmarks *self)
{
self->priv = GEDIT_COLLABORATION_BOOKMARKS_GET_PRIVATE (self);
@@ -482,3 +487,9 @@ gedit_collaboration_bookmarks_remove (GeditCollaborationBookmarks *bookmarks,
g_object_unref (bookmark);
}
}
+
+void
+_gedit_collaboration_bookmarks_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_bookmarks_register_type (type_module);
+}
diff --git a/src/gedit-collaboration-bookmarks.h b/src/gedit-collaboration-bookmarks.h
index 15a7e08..c5c8b4a 100644
--- a/src/gedit-collaboration-bookmarks.h
+++ b/src/gedit-collaboration-bookmarks.h
@@ -8,30 +8,32 @@
G_BEGIN_DECLS
-#define GEDIT_COLLABORATION_TYPE_BOOKMARKS (gedit_collaboration_bookmarks_get_type ())
-#define GEDIT_COLLABORATION_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARKS, GeditCollaborationBookmarks))
-#define GEDIT_COLLABORATION_BOOKMARKS_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARKS, GeditCollaborationBookmarks const))
-#define GEDIT_COLLABORATION_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_BOOKMARKS, GeditCollaborationBookmarksClass))
-#define GEDIT_COLLABORATION_IS_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARKS))
+#define GEDIT_COLLABORATION_TYPE_BOOKMARKS (gedit_collaboration_bookmarks_get_type ())
+#define GEDIT_COLLABORATION_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARKS, GeditCollaborationBookmarks))
+#define GEDIT_COLLABORATION_BOOKMARKS_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARKS, GeditCollaborationBookmarks const))
+#define GEDIT_COLLABORATION_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_BOOKMARKS, GeditCollaborationBookmarksClass))
+#define GEDIT_COLLABORATION_IS_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARKS))
#define GEDIT_COLLABORATION_IS_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_COLLABORATION_TYPE_BOOKMARKS))
#define GEDIT_COLLABORATION_BOOKMARKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_COLLABORATION_TYPE_BOOKMARKS, GeditCollaborationBookmarksClass))
-typedef struct _GeditCollaborationBookmarks GeditCollaborationBookmarks;
+typedef struct _GeditCollaborationBookmarks GeditCollaborationBookmarks;
typedef struct _GeditCollaborationBookmarksClass GeditCollaborationBookmarksClass;
typedef struct _GeditCollaborationBookmarksPrivate GeditCollaborationBookmarksPrivate;
-struct _GeditCollaborationBookmarks {
+struct _GeditCollaborationBookmarks
+{
GObject parent;
GeditCollaborationBookmarksPrivate *priv;
};
-struct _GeditCollaborationBookmarksClass {
+struct _GeditCollaborationBookmarksClass
+{
GObjectClass parent_class;
};
-GType gedit_collaboration_bookmarks_register_type (GTypeModule *module);
GType gedit_collaboration_bookmarks_get_type (void) G_GNUC_CONST;
+void _gedit_collaboration_bookmarks_register_type (GTypeModule *module);
GeditCollaborationBookmarks *gedit_collaboration_bookmarks_initialize (gchar const *filename);
GeditCollaborationBookmarks *gedit_collaboration_bookmarks_get_default (void);
diff --git a/src/gedit-collaboration-color-button.c b/src/gedit-collaboration-color-button.c
index ebda584..b6051aa 100644
--- a/src/gedit-collaboration-color-button.c
+++ b/src/gedit-collaboration-color-button.c
@@ -3,7 +3,6 @@
#include "gedit-collaboration-color-button.h"
#include <config.h>
-#include <gedit/gedit-plugin.h>
#include <libinftextgtk/inf-text-gtk-hue-chooser.h>
#include <glib/gi18n-lib.h>
#include "gedit-collaboration.h"
@@ -14,17 +13,22 @@ struct _GeditCollaborationColorButtonPrivate
{
GtkWidget *color_dialog;
GtkWidget *hue_chooser;
+
gboolean modal;
+ gdouble hue;
};
/* Properties */
enum
{
PROP_0,
- PROP_MODAL
+ PROP_MODAL,
+ PROP_HUE
};
-GEDIT_PLUGIN_DEFINE_TYPE (GeditCollaborationColorButton, gedit_collaboration_color_button, GTK_TYPE_COLOR_BUTTON)
+G_DEFINE_DYNAMIC_TYPE (GeditCollaborationColorButton,
+ gedit_collaboration_color_button,
+ GTK_TYPE_COLOR_BUTTON)
static void
gedit_collaboration_color_button_finalize (GObject *object)
@@ -99,7 +103,22 @@ color_button_clicked (GtkButton *button)
}
static void
-gedit_collaboration_color_button_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+set_hue (GeditCollaborationColorButton *button,
+ gdouble hue)
+{
+ GdkColor color;
+
+ button->priv->hue = hue;
+
+ gedit_collaboration_hue_to_color (hue, &color);
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (button), &color);
+}
+
+static void
+gedit_collaboration_color_button_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GeditCollaborationColorButton *self = GEDIT_COLLABORATION_COLOR_BUTTON (object);
@@ -114,6 +133,9 @@ gedit_collaboration_color_button_set_property (GObject *object, guint prop_id, c
self->priv->modal);
}
break;
+ case PROP_HUE:
+ set_hue (self, g_value_get_double (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -121,7 +143,10 @@ gedit_collaboration_color_button_set_property (GObject *object, guint prop_id, c
}
static void
-gedit_collaboration_color_button_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gedit_collaboration_color_button_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GeditCollaborationColorButton *self = GEDIT_COLLABORATION_COLOR_BUTTON (object);
@@ -130,6 +155,9 @@ gedit_collaboration_color_button_get_property (GObject *object, guint prop_id, G
case PROP_MODAL:
g_value_set_boolean (value, self->priv->modal);
break;
+ case PROP_HUE:
+ g_value_set_double (value, self->priv->hue);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -157,6 +185,22 @@ gedit_collaboration_color_button_class_init (GeditCollaborationColorButtonClass
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_type_class_add_private (object_class, sizeof(GeditCollaborationColorButtonPrivate));
+
+
+ g_object_class_install_property (object_class,
+ PROP_HUE,
+ g_param_spec_double ("hue",
+ "Hue",
+ "Hue",
+ 0.0,
+ 1.0,
+ 0.0,
+ G_PARAM_READWRITE));
+}
+
+static void
+gedit_collaboration_color_button_class_finalize (GeditCollaborationColorButtonClass *klass)
+{
}
static void
@@ -175,23 +219,23 @@ void
gedit_collaboration_color_button_set_hue (GeditCollaborationColorButton *button,
gdouble hue)
{
- GdkColor color;
g_return_if_fail (GEDIT_COLLABORATION_IS_COLOR_BUTTON (button));
- gedit_collaboration_hue_to_color (hue, &color);
- gtk_color_button_set_color (GTK_COLOR_BUTTON (button), &color);
+ set_hue (button, hue);
+ g_object_notify (G_OBJECT (button), "hue");
}
gdouble
gedit_collaboration_color_button_get_hue (GeditCollaborationColorButton *button)
{
- GdkColor color;
-
g_return_val_if_fail (GEDIT_COLLABORATION_IS_COLOR_BUTTON (button), 0.0);
- gtk_color_button_get_color (GTK_COLOR_BUTTON (button),
- &color);
+ return button->priv->hue;
+}
- return gedit_collaboration_color_to_hue (&color);
+void
+_gedit_collaboration_color_button_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_color_button_register_type (type_module);
}
diff --git a/src/gedit-collaboration-color-button.h b/src/gedit-collaboration-color-button.h
index 0ddc332..c4a730e 100644
--- a/src/gedit-collaboration-color-button.h
+++ b/src/gedit-collaboration-color-button.h
@@ -7,30 +7,32 @@
G_BEGIN_DECLS
-#define GEDIT_COLLABORATION_TYPE_COLOR_BUTTON (gedit_collaboration_color_button_get_type ())
-#define GEDIT_COLLABORATION_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON, GeditCollaborationColorButton))
-#define GEDIT_COLLABORATION_COLOR_BUTTON_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON, GeditCollaborationColorButton const))
+#define GEDIT_COLLABORATION_TYPE_COLOR_BUTTON (gedit_collaboration_color_button_get_type ())
+#define GEDIT_COLLABORATION_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON, GeditCollaborationColorButton))
+#define GEDIT_COLLABORATION_COLOR_BUTTON_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON, GeditCollaborationColorButton const))
#define GEDIT_COLLABORATION_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON, GeditCollaborationColorButtonClass))
-#define GEDIT_COLLABORATION_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON))
+#define GEDIT_COLLABORATION_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON))
#define GEDIT_COLLABORATION_IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON))
#define GEDIT_COLLABORATION_COLOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_COLLABORATION_TYPE_COLOR_BUTTON, GeditCollaborationColorButtonClass))
-typedef struct _GeditCollaborationColorButton GeditCollaborationColorButton;
-typedef struct _GeditCollaborationColorButtonClass GeditCollaborationColorButtonClass;
+typedef struct _GeditCollaborationColorButton GeditCollaborationColorButton;
+typedef struct _GeditCollaborationColorButtonClass GeditCollaborationColorButtonClass;
typedef struct _GeditCollaborationColorButtonPrivate GeditCollaborationColorButtonPrivate;
-struct _GeditCollaborationColorButton {
+struct _GeditCollaborationColorButton
+{
GtkColorButton parent;
GeditCollaborationColorButtonPrivate *priv;
};
-struct _GeditCollaborationColorButtonClass {
+struct _GeditCollaborationColorButtonClass
+{
GtkColorButtonClass parent_class;
};
GType gedit_collaboration_color_button_get_type (void) G_GNUC_CONST;
-GType gedit_collaboration_color_button_register_type (GTypeModule *type_module);
+void _gedit_collaboration_color_button_register_type (GTypeModule *type_module);
GeditCollaborationColorButton *gedit_collaboration_color_button_new (void);
diff --git a/src/gedit-collaboration-configuration.ui b/src/gedit-collaboration-configuration.ui
index 687fd22..96837af 100644
--- a/src/gedit-collaboration-configuration.ui
+++ b/src/gedit-collaboration-configuration.ui
@@ -2,120 +2,81 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
- <object class="GtkDialog" id="dialog_configuration">
- <property name="border_width">5</property>
- <property name="type_hint">normal</property>
- <property name="has_separator">False</property>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
+ <object class="GtkVBox" id="vbox_configuration">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">3</property>
<child>
- <object class="GtkTable" id="table1">
+ <object class="GtkLabel" id="label_name">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">3</property>
- <child>
- <object class="GtkLabel" id="label_name">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Name:</property>
- </object>
- <packing>
- <property name="x_options">GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_color">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Color:</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_name">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">&#x25CF;</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <child>
- <object class="GeditCollaborationColorButton" id="color_button_hue">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- <property name="modal">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Name:</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="x_options">GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
+ <child>
+ <object class="GtkLabel" id="label_color">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Color:</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">&#x25CF;</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <placeholder/>
- </child>
<child>
- <object class="GtkButton" id="button_close">
- <property name="label" translatable="yes">gtk-close</property>
+ <object class="GeditCollaborationColorButton" id="color_button_hue">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <property name="image_position">right</property>
+ <property name="color">#000000000000</property>
+ <property name="modal">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
</child>
- <action-widgets>
- <action-widget response="0">button_close</action-widget>
- </action-widgets>
</object>
</interface>
diff --git a/src/gedit-collaboration-document-message.c b/src/gedit-collaboration-document-message.c
index be80a64..e7170a1 100644
--- a/src/gedit-collaboration-document-message.c
+++ b/src/gedit-collaboration-document-message.c
@@ -1,7 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include "gedit-collaboration-document-message.h"
-#include <gedit/gedit-plugin.h>
#include "gedit-collaboration.h"
#include <config.h>
#include <glib/gi18n-lib.h>
@@ -16,7 +15,9 @@ struct _GeditCollaborationDocumentMessagePrivate
GtkWidget *progress;
};
-GEDIT_PLUGIN_DEFINE_TYPE (GeditCollaborationDocumentMessage, gedit_collaboration_document_message, GTK_TYPE_INFO_BAR)
+G_DEFINE_DYNAMIC_TYPE (GeditCollaborationDocumentMessage,
+ gedit_collaboration_document_message,
+ GTK_TYPE_INFO_BAR)
static void
gedit_collaboration_document_message_finalize (GObject *object)
@@ -60,7 +61,7 @@ set_message_area_text_and_icon (GeditCollaborationDocumentMessage *message_area,
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
- GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
if (secondary_text != NULL)
@@ -73,7 +74,7 @@ set_message_area_text_and_icon (GeditCollaborationDocumentMessage *message_area,
secondary_label = gtk_label_new (secondary_markup);
g_free (secondary_markup);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (secondary_label, TRUE);
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
@@ -106,6 +107,11 @@ gedit_collaboration_document_message_class_init (GeditCollaborationDocumentMessa
}
static void
+gedit_collaboration_document_message_class_finalize (GeditCollaborationDocumentMessageClass *klass)
+{
+}
+
+static void
gedit_collaboration_document_message_init (GeditCollaborationDocumentMessage *self)
{
self->priv = GEDIT_COLLABORATION_DOCUMENT_MESSAGE_GET_PRIVATE (self);
@@ -232,3 +238,9 @@ gedit_collaboration_document_message_update (GeditCollaborationDocumentMessage *
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (document_message->priv->progress),
fraction);
}
+
+void
+_gedit_collaboration_document_message_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_document_message_register_type (type_module);
+}
diff --git a/src/gedit-collaboration-document-message.h b/src/gedit-collaboration-document-message.h
index 189f47d..e1cfc67 100644
--- a/src/gedit-collaboration-document-message.h
+++ b/src/gedit-collaboration-document-message.h
@@ -19,18 +19,20 @@ typedef struct _GeditCollaborationDocumentMessage GeditCollaborationDocumentMes
typedef struct _GeditCollaborationDocumentMessageClass GeditCollaborationDocumentMessageClass;
typedef struct _GeditCollaborationDocumentMessagePrivate GeditCollaborationDocumentMessagePrivate;
-struct _GeditCollaborationDocumentMessage {
+struct _GeditCollaborationDocumentMessage
+{
GtkInfoBar parent;
GeditCollaborationDocumentMessagePrivate *priv;
};
-struct _GeditCollaborationDocumentMessageClass {
+struct _GeditCollaborationDocumentMessageClass
+{
GtkInfoBarClass parent_class;
};
GType gedit_collaboration_document_message_get_type (void) G_GNUC_CONST;
-GType gedit_collaboration_document_message_register_type (GTypeModule *type_module);
+void _gedit_collaboration_document_message_register_type (GTypeModule *type_module);
GQuark gedit_collaboration_document_message_error_quark (void);
diff --git a/src/gedit-collaboration-hue-renderer.c b/src/gedit-collaboration-hue-renderer.c
index 9b7d88d..905eed0 100644
--- a/src/gedit-collaboration-hue-renderer.c
+++ b/src/gedit-collaboration-hue-renderer.c
@@ -1,7 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include "gedit-collaboration-hue-renderer.h"
-#include <gedit/gedit-plugin.h>
#include "gedit-collaboration.h"
#define GEDIT_COLLABORATION_HUE_RENDERER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_TYPE_COLLABORATION_HUE_RENDERER, GeditCollaborationHueRendererPrivate))
@@ -17,7 +16,9 @@ enum
PROP_HUE
};
-GEDIT_PLUGIN_DEFINE_TYPE (GeditCollaborationHueRenderer, gedit_collaboration_hue_renderer, GTK_TYPE_CELL_RENDERER)
+G_DEFINE_DYNAMIC_TYPE (GeditCollaborationHueRenderer,
+ gedit_collaboration_hue_renderer,
+ GTK_TYPE_CELL_RENDERER)
static void
gedit_collaboration_hue_renderer_finalize (GObject *object)
@@ -195,6 +196,11 @@ gedit_collaboration_hue_renderer_class_init (GeditCollaborationHueRendererClass
}
static void
+gedit_collaboration_hue_renderer_class_finalize (GeditCollaborationHueRendererClass *klass)
+{
+}
+
+static void
gedit_collaboration_hue_renderer_init (GeditCollaborationHueRenderer *self)
{
self->priv = GEDIT_COLLABORATION_HUE_RENDERER_GET_PRIVATE (self);
@@ -205,3 +211,9 @@ gedit_collaboration_hue_renderer_new ()
{
return g_object_new (GEDIT_TYPE_COLLABORATION_HUE_RENDERER, NULL);
}
+
+void
+_gedit_collaboration_hue_renderer_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_hue_renderer_register_type (type_module);
+}
diff --git a/src/gedit-collaboration-hue-renderer.h b/src/gedit-collaboration-hue-renderer.h
index b56cce1..69b7bf6 100644
--- a/src/gedit-collaboration-hue-renderer.h
+++ b/src/gedit-collaboration-hue-renderer.h
@@ -7,30 +7,32 @@
G_BEGIN_DECLS
-#define GEDIT_TYPE_COLLABORATION_HUE_RENDERER (gedit_collaboration_hue_renderer_get_type ())
-#define GEDIT_COLLABORATION_HUE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_COLLABORATION_HUE_RENDERER, GeditCollaborationHueRenderer))
-#define GEDIT_COLLABORATION_HUE_RENDERER_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_COLLABORATION_HUE_RENDERER, GeditCollaborationHueRenderer const))
+#define GEDIT_TYPE_COLLABORATION_HUE_RENDERER (gedit_collaboration_hue_renderer_get_type ())
+#define GEDIT_COLLABORATION_HUE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_COLLABORATION_HUE_RENDERER, GeditCollaborationHueRenderer))
+#define GEDIT_COLLABORATION_HUE_RENDERER_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_COLLABORATION_HUE_RENDERER, GeditCollaborationHueRenderer const))
#define GEDIT_COLLABORATION_HUE_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_COLLABORATION_HUE_RENDERER, GeditCollaborationHueRendererClass))
-#define GEDIT_IS_COLLABORATION_HUE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_COLLABORATION_HUE_RENDERER))
+#define GEDIT_IS_COLLABORATION_HUE_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_COLLABORATION_HUE_RENDERER))
#define GEDIT_IS_COLLABORATION_HUE_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_COLLABORATION_HUE_RENDERER))
#define GEDIT_COLLABORATION_HUE_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_COLLABORATION_HUE_RENDERER, GeditCollaborationHueRendererClass))
-typedef struct _GeditCollaborationHueRenderer GeditCollaborationHueRenderer;
-typedef struct _GeditCollaborationHueRendererClass GeditCollaborationHueRendererClass;
+typedef struct _GeditCollaborationHueRenderer GeditCollaborationHueRenderer;
+typedef struct _GeditCollaborationHueRendererClass GeditCollaborationHueRendererClass;
typedef struct _GeditCollaborationHueRendererPrivate GeditCollaborationHueRendererPrivate;
-struct _GeditCollaborationHueRenderer {
+struct _GeditCollaborationHueRenderer
+{
GtkCellRenderer parent;
GeditCollaborationHueRendererPrivate *priv;
};
-struct _GeditCollaborationHueRendererClass {
+struct _GeditCollaborationHueRendererClass
+{
GtkCellRendererClass parent_class;
};
GType gedit_collaboration_hue_renderer_get_type (void) G_GNUC_CONST;
-GType gedit_collaboration_hue_renderer_register_type (GTypeModule *type_module);
+void _gedit_collaboration_hue_renderer_register_type (GTypeModule *type_module);
GtkCellRenderer *gedit_collaboration_hue_renderer_new (void);
diff --git a/src/gedit-collaboration-manager.c b/src/gedit-collaboration-manager.c
index 6cdcfd9..55f57f8 100644
--- a/src/gedit-collaboration-manager.c
+++ b/src/gedit-collaboration-manager.c
@@ -1,7 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include "gedit-collaboration-manager.h"
-#include <gedit/gedit-plugin.h>
#include <libinfinity/adopted/inf-adopted-session.h>
#include <libinftext/inf-text-session.h>
#include <libinftext/inf-text-buffer.h>
@@ -83,7 +82,9 @@ static guint signals[NUM_SIGNALS] = {0,};
static void request_join (GeditCollaborationSubscription *subscription, const gchar *name);
static void gedit_collaboration_subscription_free (GeditCollaborationSubscription *subscription);
-GEDIT_PLUGIN_DEFINE_TYPE (GeditCollaborationManager, gedit_collaboration_manager, G_TYPE_OBJECT)
+G_DEFINE_DYNAMIC_TYPE (GeditCollaborationManager,
+ gedit_collaboration_manager,
+ G_TYPE_OBJECT);
static void
gedit_collaboration_manager_finalize (GObject *object)
@@ -188,6 +189,12 @@ gedit_collaboration_manager_class_init (GeditCollaborationManagerClass *klass)
}
static void
+gedit_collaboration_manager_class_finalize (GeditCollaborationManagerClass *klass)
+{
+
+}
+
+static void
update_saturation_value (GtkWidget *widget,
InfTextGtkBuffer *buffer)
{
@@ -468,7 +475,6 @@ handle_error (GeditCollaborationSubscription *subscription,
{
/* Show the error nicely in the document, and cancel the session,
cleanup, etc */
-#ifndef GEDIT_STABLE
if (subscription->tab)
{
GtkWidget *message_area;
@@ -489,7 +495,6 @@ handle_error (GeditCollaborationSubscription *subscription,
}
else
{
-#endif
gchar *primary;
gchar *escaped;
gchar *secondary;
@@ -517,10 +522,7 @@ handle_error (GeditCollaborationSubscription *subscription,
NULL);
gtk_widget_show (dialog);
-
-#ifndef GEDIT_STABLE
}
-#endif
/* This will also clean up the session */
close_subscription (subscription);
@@ -645,7 +647,6 @@ request_join (GeditCollaborationSubscription *subscription,
subscription);
}
-#ifndef GEDIT_STABLE
static gchar *
guess_content_type (GeditCollaborationSubscription *subscription)
{
@@ -671,7 +672,6 @@ guess_content_type (GeditCollaborationSubscription *subscription)
g_free (text);
return content_type;
}
-#endif
static void
on_synchronization_complete (InfSession *session,
@@ -688,7 +688,6 @@ on_synchronization_complete (InfSession *session,
subscription->signal_handlers[SYNCHRONIZATION_PROGRESS]);
subscription->signal_handlers[SYNCHRONIZATION_PROGRESS] = 0;
-#ifndef GEDIT_STABLE
gedit_tab_set_info_bar (subscription->tab, NULL);
/* Now guess with the content too */
@@ -696,7 +695,6 @@ on_synchronization_complete (InfSession *session,
gedit_document_set_content_type (gedit_tab_get_document (subscription->tab),
content_type);
g_free (content_type);
-#endif
subscription->progress_area = NULL;
@@ -723,7 +721,6 @@ on_synchronization_progress (InfSession *session,
gdouble progress,
GeditCollaborationSubscription *subscription)
{
-#ifndef GEDIT_STABLE
if (subscription->progress_area != NULL)
{
GeditCollaborationDocumentMessage *msg;
@@ -750,7 +747,6 @@ on_synchronization_progress (InfSession *session,
gedit_tab_set_info_bar (subscription->tab,
subscription->progress_area);
}
-#endif
}
static void
@@ -822,21 +818,17 @@ on_subscribe_request_finished (InfcNodeRequest *request,
name = infc_browser_iter_get_name (subscription->browser, &subscription->iter);
-#ifndef GEDIT_STABLE
/* First guess the content type just from the name */
content_type = g_content_type_guess (name, NULL, 0, NULL);
gedit_document_set_content_type (doc, content_type);
g_free (content_type);
-#endif
gtk_source_buffer_begin_not_undoable_action (GTK_SOURCE_BUFFER (doc));
gtk_text_buffer_begin_user_action (GTK_TEXT_BUFFER (doc));
subscription->loading = TRUE;
-#ifndef GEDIT_STABLE
gedit_document_set_short_name_for_display (doc, name);
-#endif
subscription->signal_handlers[STYLE_SET] =
g_signal_connect (view,
@@ -1003,3 +995,9 @@ gedit_collaboration_subscription_get_user_store (GeditCollaborationSubscription
{
return subscription->user_store;
}
+
+void
+_gedit_collaboration_manager_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_manager_register_type (type_module);
+}
diff --git a/src/gedit-collaboration-manager.h b/src/gedit-collaboration-manager.h
index 1234ba6..4c56dee 100644
--- a/src/gedit-collaboration-manager.h
+++ b/src/gedit-collaboration-manager.h
@@ -26,18 +26,20 @@ typedef struct _GeditCollaborationManagerPrivate GeditCollaborationManagerPrivat
typedef struct _GeditCollaborationSubscription GeditCollaborationSubscription;
-struct _GeditCollaborationManager {
+struct _GeditCollaborationManager
+{
GObject parent;
GeditCollaborationManagerPrivate *priv;
};
-struct _GeditCollaborationManagerClass {
+struct _GeditCollaborationManagerClass
+{
GObjectClass parent_class;
};
GType gedit_collaboration_manager_get_type (void) G_GNUC_CONST;
-GType gedit_collaboration_manager_register_type (GTypeModule *type_module);
+void _gedit_collaboration_manager_register_type (GTypeModule *type_module);
GeditCollaborationManager *gedit_collaboration_manager_new (GeditWindow *window);
diff --git a/src/gedit-collaboration-plugin.c b/src/gedit-collaboration-plugin.c
index f80a2b9..97771a3 100644
--- a/src/gedit-collaboration-plugin.c
+++ b/src/gedit-collaboration-plugin.c
@@ -22,6 +22,10 @@
* Boston, MA 02110-1301 USA
*/
+#include <gedit/gedit-app-activatable.h>
+#include <libpeas-gtk/peas-gtk-configurable.h>
+#include <gedit/gedit-app.h>
+
#include "gedit-collaboration-plugin.h"
#include "gedit-collaboration-window-helper.h"
#include "gedit-collaboration-bookmarks.h"
@@ -41,55 +45,126 @@
#define WINDOW_DATA_KEY "GeditCollaborationPluginWindowData"
+static GeditCollaborationPlugin *plugin_instance = 0;
+
struct _GeditCollaborationPluginPrivate
{
+ GeditApp *app;
+
GtkWidget *dialog_configuration;
GtkEntry *entry_name;
GeditCollaborationColorButton *color_button_hue;
};
-GEDIT_PLUGIN_REGISTER_TYPE_WITH_CODE (GeditCollaborationPlugin, gedit_collaboration_plugin, \
- gedit_collaboration_window_helper_register_type (type_module); \
- gedit_collaboration_manager_register_type (type_module); \
- gedit_collaboration_bookmark_register_type (type_module); \
- gedit_collaboration_bookmarks_register_type (type_module); \
- gedit_collaboration_bookmark_dialog_register_type (type_module); \
- gedit_collaboration_color_button_register_type (type_module); \
- gedit_collaboration_document_message_register_type (type_module); \
- gedit_collaboration_undo_manager_register_type (type_module); \
- gedit_collaboration_user_store_register_type (type_module); \
- gedit_collaboration_hue_renderer_register_type (type_module); \
+/* Properties */
+enum
+{
+ PROP_0,
+ PROP_APP
+};
+
+static void gedit_app_activatable_iface_init (GeditAppActivatableInterface *iface);
+static void peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditCollaborationPlugin,
+ gedit_collaboration_plugin,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (GEDIT_TYPE_APP_ACTIVATABLE,
+ gedit_app_activatable_iface_init) \
+ G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_GTK_TYPE_CONFIGURABLE,
+ peas_gtk_configurable_iface_init) \
+ _gedit_collaboration_window_helper_register_type (type_module); \
+ _gedit_collaboration_manager_register_type (type_module); \
+ _gedit_collaboration_bookmark_register_type (type_module); \
+ _gedit_collaboration_bookmarks_register_type (type_module); \
+ _gedit_collaboration_bookmark_dialog_register_type (type_module); \
+ _gedit_collaboration_color_button_register_type (type_module); \
+ _gedit_collaboration_document_message_register_type (type_module); \
+ _gedit_collaboration_undo_manager_register_type (type_module); \
+ _gedit_collaboration_user_store_register_type (type_module); \
+ _gedit_collaboration_hue_renderer_register_type (type_module); \
)
static void
-gedit_collaboration_plugin_finalize (GObject *object)
+gedit_app_activatable_iface_init (GeditAppActivatableInterface *iface)
{
- G_OBJECT_CLASS (gedit_collaboration_plugin_parent_class)->finalize (object);
}
static void
-plugin_activate_impl (GeditPlugin *plugin,
- GeditWindow *window)
+on_entry_name_focus_out (GtkEntry *entry,
+ GdkEventFocus *event,
+ GeditCollaborationUser *user)
{
- GeditCollaborationWindowHelper *helper;
+ const gchar *name = gtk_entry_get_text (entry);
+ gedit_collaboration_user_set_name (user, name);
+}
+
+static void
+on_color_button_hue_changed (GeditCollaborationColorButton *button,
+ GParamSpec *spec,
+ GeditCollaborationUser *user)
+{
+ gedit_collaboration_user_set_hue (user,
+ gedit_collaboration_color_button_get_hue (button));
+}
+
+static GtkWidget *
+gedit_collaboration_plugin_create_configure_widget (PeasGtkConfigurable *configurable)
+{
+ GtkBuilder *builder;
+ gchar *datadir;
+ GtkEntry *entry;
+ GeditCollaborationColorButton *color_button;
+ GeditCollaborationUser *user;
+ GtkWidget *ret;
- helper = gedit_collaboration_window_helper_new (window,
- gedit_plugin_get_data_dir (plugin));
+ datadir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (configurable));
+ builder = gedit_collaboration_create_builder (datadir,
+ "gedit-collaboration-configuration.ui");
+ g_free (datadir);
- if (helper != NULL)
+ if (!builder)
{
- g_object_set_data_full (G_OBJECT (window),
- WINDOW_DATA_KEY,
- helper,
- (GDestroyNotify)g_object_unref);
+ return NULL;
}
+
+ user = gedit_collaboration_user_get_default ();
+
+ entry = GTK_ENTRY (gtk_builder_get_object (builder, "entry_name"));
+ g_signal_connect (entry,
+ "focus-out-event",
+ G_CALLBACK (on_entry_name_focus_out),
+ user);
+
+ color_button = GEDIT_COLLABORATION_COLOR_BUTTON (gtk_builder_get_object (builder, "color_button_hue"));
+ g_signal_connect (color_button,
+ "notify::hue",
+ G_CALLBACK (on_color_button_hue_changed),
+ user);
+
+ gtk_entry_set_text (entry,
+ gedit_collaboration_user_get_name (user));
+
+ gedit_collaboration_color_button_set_hue (color_button,
+ gedit_collaboration_user_get_hue (user));
+
+ ret = g_object_ref (gtk_builder_get_object (builder, "vbox_configuration"));
+ g_object_unref (builder);
+
+ return ret;
}
static void
-plugin_deactivate_impl (GeditPlugin *plugin,
- GeditWindow *window)
+peas_gtk_configurable_iface_init (PeasGtkConfigurableInterface *iface)
{
- g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
+ iface->create_configure_widget = gedit_collaboration_plugin_create_configure_widget;
+}
+
+static void
+gedit_collaboration_plugin_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gedit_collaboration_plugin_parent_class)->finalize (object);
}
static void
@@ -97,9 +172,9 @@ gedit_collaboration_plugin_constructed (GObject *object)
{
gchar *filename;
- filename = g_build_filename (g_get_home_dir (),
- ".gnome2",
+ filename = g_build_filename (g_get_user_config_dir (),
"gedit",
+ "plugins",
"collaboration",
"bookmarks.xml",
NULL);
@@ -107,88 +182,62 @@ gedit_collaboration_plugin_constructed (GObject *object)
gedit_collaboration_bookmarks_initialize (filename);
}
-static void
-on_dialog_configuration_response (GtkWidget *widget,
- gint responseid,
- GeditCollaborationPlugin *plugin)
+static GObject *
+gedit_collaboration_plugin_constructor (GType type,
+ guint n_parameters,
+ GObjectConstructParam *parameters)
{
- GeditCollaborationUser *user;
- const gchar *name;
-
- user = gedit_collaboration_user_get_default ();
- name = gtk_entry_get_text (plugin->priv->entry_name);
+ GObject *ret;
- if (*name)
+ if (plugin_instance != NULL)
{
- gedit_collaboration_user_set_name (user, name);
+ return g_object_ref (plugin_instance);
}
- gedit_collaboration_user_set_hue (user,
- gedit_collaboration_color_button_get_hue (plugin->priv->color_button_hue));
+ ret = G_OBJECT_CLASS (gedit_collaboration_plugin_parent_class)->constructor (type,
+ n_parameters,
+ parameters);
- gtk_widget_destroy (widget);
- plugin->priv->dialog_configuration = NULL;
+ g_object_add_weak_pointer (ret,
+ (gpointer *)&ret);
+ return ret;
}
static void
-create_configuration_dialog (GeditCollaborationPlugin *plugin)
+gedit_collaboration_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GtkBuilder *builder;
+ GeditCollaborationPlugin *self = GEDIT_COLLABORATION_PLUGIN (object);
- builder = gedit_collaboration_create_builder (gedit_plugin_get_data_dir (GEDIT_PLUGIN (plugin)),
- "gedit-collaboration-configuration.ui");
-
- if (!builder)
+ switch (prop_id)
{
- return;
+ case PROP_APP:
+ self->priv->app = g_value_get_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
-
- plugin->priv->dialog_configuration = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_configuration"));
- plugin->priv->entry_name = GTK_ENTRY (gtk_builder_get_object (builder, "entry_name"));
- plugin->priv->color_button_hue = GEDIT_COLLABORATION_COLOR_BUTTON (gtk_builder_get_object (builder, "color_button_hue"));
-}
-
-static GtkWidget *
-plugin_create_configure_dialog_impl (GeditPlugin *plugin)
-{
- GeditCollaborationPlugin *self = GEDIT_COLLABORATION_PLUGIN (plugin);
- GeditCollaborationUser *user = gedit_collaboration_user_get_default ();
-
- if (self->priv->dialog_configuration == NULL)
- {
- create_configuration_dialog (self);
-
- if (!self->priv->dialog_configuration)
- {
- return NULL;
- }
-
- g_signal_connect (self->priv->dialog_configuration,
- "response",
- G_CALLBACK (on_dialog_configuration_response),
- self);
- }
-
- gtk_entry_set_text (self->priv->entry_name,
- gedit_collaboration_user_get_name (user));
-
- gedit_collaboration_color_button_set_hue (self->priv->color_button_hue,
- gedit_collaboration_user_get_hue (user));
-
- return self->priv->dialog_configuration;
}
static void
-plugin_update_ui_impl (GeditPlugin *plugin,
- GeditWindow *window)
+gedit_collaboration_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- GeditCollaborationWindowHelper *helper;
-
- helper = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
+ GeditCollaborationPlugin *self = GEDIT_COLLABORATION_PLUGIN (object);
- if (helper)
+ switch (prop_id)
{
- gedit_collaboration_window_helper_update_ui (helper);
+ case PROP_APP:
+ g_value_set_object (value, self->priv->app);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
@@ -196,17 +245,29 @@ static void
gedit_collaboration_plugin_class_init (GeditCollaborationPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GeditPluginClass *plugin_class = GEDIT_PLUGIN_CLASS (klass);
object_class->finalize = gedit_collaboration_plugin_finalize;
- object_class->constructed = gedit_collaboration_plugin_constructed;
- plugin_class->activate = plugin_activate_impl;
- plugin_class->deactivate = plugin_deactivate_impl;
- plugin_class->create_configure_dialog = plugin_create_configure_dialog_impl;
- plugin_class->update_ui = plugin_update_ui_impl;
+ object_class->get_property = gedit_collaboration_plugin_get_property;
+ object_class->set_property = gedit_collaboration_plugin_set_property;
+
+ object_class->constructed = gedit_collaboration_plugin_constructed;
+ object_class->constructor = gedit_collaboration_plugin_constructor;
g_type_class_add_private (object_class, sizeof(GeditCollaborationPluginPrivate));
+
+ g_object_class_install_property (object_class,
+ PROP_APP,
+ g_param_spec_object ("app",
+ "App",
+ "App",
+ GEDIT_TYPE_APP,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+gedit_collaboration_plugin_class_finalize (GeditCollaborationPluginClass *klass)
+{
}
static void
@@ -216,3 +277,17 @@ gedit_collaboration_plugin_init (GeditCollaborationPlugin *plugin)
inf_init (NULL);
}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ gedit_collaboration_plugin_register_type (G_TYPE_MODULE (module));
+
+ peas_object_module_register_extension_type (module,
+ GEDIT_TYPE_APP_ACTIVATABLE,
+ GEDIT_TYPE_COLLABORATION_PLUGIN);
+
+ peas_object_module_register_extension_type (module,
+ PEAS_GTK_TYPE_CONFIGURABLE,
+ GEDIT_TYPE_COLLABORATION_PLUGIN);
+}
diff --git a/src/gedit-collaboration-plugin.h b/src/gedit-collaboration-plugin.h
index a5ea0d3..7934ee2 100644
--- a/src/gedit-collaboration-plugin.h
+++ b/src/gedit-collaboration-plugin.h
@@ -3,7 +3,8 @@
#ifndef __GEDIT_COLLABORATION_PLUGIN_H__
#define __GEDIT_COLLABORATION_PLUGIN_H__
-#include <gedit/gedit-plugin.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
G_BEGIN_DECLS
@@ -15,23 +16,25 @@ G_BEGIN_DECLS
#define GEDIT_IS_COLLABORATION_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_COLLABORATION_PLUGIN))
#define GEDIT_COLLABORATION_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_COLLABORATION_PLUGIN, GeditCollaborationPluginClass))
-typedef struct _GeditCollaborationPlugin GeditCollaborationPlugin;
+typedef struct _GeditCollaborationPlugin GeditCollaborationPlugin;
typedef struct _GeditCollaborationPluginClass GeditCollaborationPluginClass;
typedef struct _GeditCollaborationPluginPrivate GeditCollaborationPluginPrivate;
-struct _GeditCollaborationPlugin {
- GeditPlugin parent;
+struct _GeditCollaborationPlugin
+{
+ PeasExtensionBase parent;
GeditCollaborationPluginPrivate *priv;
};
-struct _GeditCollaborationPluginClass {
- GeditPluginClass parent_class;
+struct _GeditCollaborationPluginClass
+{
+ PeasExtensionBaseClass parent_class;
};
GType gedit_collaboration_plugin_get_type (void) G_GNUC_CONST;
-G_MODULE_EXPORT GType gedit_register_plugin (GTypeModule *module);
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
G_END_DECLS
diff --git a/src/gedit-collaboration-undo-manager.c b/src/gedit-collaboration-undo-manager.c
index bdc9d8d..30a0deb 100644
--- a/src/gedit-collaboration-undo-manager.c
+++ b/src/gedit-collaboration-undo-manager.c
@@ -2,11 +2,10 @@
#include "gedit-collaboration-undo-manager.h"
-#include <gedit/gedit-plugin.h>
-
#include <libinftextgtk/inf-text-gtk-buffer.h>
#include <libinfinity/adopted/inf-adopted-undo-grouping.h>
#include <libinftext/inf-text-undo-grouping.h>
+#include <gtksourceview/gtksourceundomanager.h>
#define GEDIT_COLLABORATION_UNDO_MANAGER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER, GeditCollaborationUndoManagerPrivate))
@@ -40,10 +39,12 @@ enum
static void gedit_collaboration_undo_manager_iface_init (GtkSourceUndoManagerIface *iface);
-GEDIT_PLUGIN_DEFINE_TYPE_WITH_CODE (GeditCollaborationUndoManager, gedit_collaboration_undo_manager, G_TYPE_OBJECT,
- GEDIT_PLUGIN_IMPLEMENT_INTERFACE (gedit_collaboration_undo_manager,
- GTK_TYPE_SOURCE_UNDO_MANAGER,
- gedit_collaboration_undo_manager_iface_init))
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditCollaborationUndoManager,
+ gedit_collaboration_undo_manager,
+ G_TYPE_OBJECT,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (GTK_TYPE_SOURCE_UNDO_MANAGER,
+ gedit_collaboration_undo_manager_iface_init))
static void
gedit_collaboration_undo_manager_finalize (GObject *object)
@@ -326,6 +327,11 @@ gedit_collaboration_undo_manager_class_init (GeditCollaborationUndoManagerClass
}
static void
+gedit_collaboration_undo_manager_class_finalize (GeditCollaborationUndoManagerClass *klass)
+{
+}
+
+static void
gedit_collaboration_undo_manager_init (GeditCollaborationUndoManager *self)
{
self->priv = GEDIT_COLLABORATION_UNDO_MANAGER_GET_PRIVATE (self);
@@ -398,3 +404,9 @@ gedit_collaboration_undo_manager_iface_init (GtkSourceUndoManagerIface *iface)
iface->undo = undo_manager_undo_impl;
iface->redo = undo_manager_redo_impl;
}
+
+void
+_gedit_collaboration_undo_manager_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_undo_manager_register_type (type_module);
+}
diff --git a/src/gedit-collaboration-undo-manager.h b/src/gedit-collaboration-undo-manager.h
index a05ea38..5cf71fd 100644
--- a/src/gedit-collaboration-undo-manager.h
+++ b/src/gedit-collaboration-undo-manager.h
@@ -8,30 +8,32 @@
G_BEGIN_DECLS
-#define GEDIT_COLLABORATION_TYPE_UNDO_MANAGER (gedit_collaboration_undo_manager_get_type ())
-#define GEDIT_COLLABORATION_UNDO_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER, GeditCollaborationUndoManager))
-#define GEDIT_COLLABORATION_UNDO_MANAGER_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER, GeditCollaborationUndoManager const))
+#define GEDIT_COLLABORATION_TYPE_UNDO_MANAGER (gedit_collaboration_undo_manager_get_type ())
+#define GEDIT_COLLABORATION_UNDO_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER, GeditCollaborationUndoManager))
+#define GEDIT_COLLABORATION_UNDO_MANAGER_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER, GeditCollaborationUndoManager const))
#define GEDIT_COLLABORATION_UNDO_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER, GeditCollaborationUndoManagerClass))
-#define GEDIT_COLLABORATION_IS_UNDO_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER))
+#define GEDIT_COLLABORATION_IS_UNDO_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER))
#define GEDIT_COLLABORATION_IS_UNDO_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER))
#define GEDIT_COLLABORATION_UNDO_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_COLLABORATION_TYPE_UNDO_MANAGER, GeditCollaborationUndoManagerClass))
-typedef struct _GeditCollaborationUndoManager GeditCollaborationUndoManager;
-typedef struct _GeditCollaborationUndoManagerClass GeditCollaborationUndoManagerClass;
+typedef struct _GeditCollaborationUndoManager GeditCollaborationUndoManager;
+typedef struct _GeditCollaborationUndoManagerClass GeditCollaborationUndoManagerClass;
typedef struct _GeditCollaborationUndoManagerPrivate GeditCollaborationUndoManagerPrivate;
-struct _GeditCollaborationUndoManager {
+struct _GeditCollaborationUndoManager
+{
GObject parent;
GeditCollaborationUndoManagerPrivate *priv;
};
-struct _GeditCollaborationUndoManagerClass {
+struct _GeditCollaborationUndoManagerClass
+{
GObjectClass parent_class;
};
GType gedit_collaboration_undo_manager_get_type (void) G_GNUC_CONST;
-GType gedit_collaboration_undo_manager_register_type (GTypeModule *type_module);
+void _gedit_collaboration_undo_manager_register_type (GTypeModule *type_module);
GeditCollaborationUndoManager *gedit_collaboration_undo_manager_new (InfAdoptedSession *session,
InfAdoptedUser *user);
diff --git a/src/gedit-collaboration-user-store.c b/src/gedit-collaboration-user-store.c
index b3e1cca..ff19e07 100644
--- a/src/gedit-collaboration-user-store.c
+++ b/src/gedit-collaboration-user-store.c
@@ -1,7 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include "gedit-collaboration-user-store.h"
-#include <gedit/gedit-plugin.h>
#define GEDIT_COLLABORATION_USER_STORE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_COLLABORATION_TYPE_USER_STORE, GeditCollaborationUserStorePrivate))
@@ -21,7 +20,9 @@ enum
static void remove_user (GeditCollaborationUserStore *store, InfUser *user, gboolean disconnect_status);
static void add_user (GeditCollaborationUserStore *store, InfUser *user);
-GEDIT_PLUGIN_DEFINE_TYPE (GeditCollaborationUserStore, gedit_collaboration_user_store, GTK_TYPE_LIST_STORE)
+G_DEFINE_DYNAMIC_TYPE (GeditCollaborationUserStore,
+ gedit_collaboration_user_store,
+ GTK_TYPE_LIST_STORE)
static void
gedit_collaboration_user_store_finalize (GObject *object)
@@ -334,6 +335,11 @@ gedit_collaboration_user_store_class_init (GeditCollaborationUserStoreClass *kla
g_type_class_add_private (object_class, sizeof(GeditCollaborationUserStorePrivate));
}
+static void
+gedit_collaboration_user_store_class_finalize (GeditCollaborationUserStoreClass *klass)
+{
+}
+
static gint
iter_compare_func (GtkTreeModel *model,
GtkTreeIter *a,
@@ -418,3 +424,9 @@ gedit_collaboration_user_store_get_user (GeditCollaborationUserStore *store,
return user;
}
+
+void
+_gedit_collaboration_user_store_register_type (GTypeModule *type_module)
+{
+ gedit_collaboration_user_store_register_type (type_module);
+}
diff --git a/src/gedit-collaboration-user-store.h b/src/gedit-collaboration-user-store.h
index f5ca4c2..52b10f6 100644
--- a/src/gedit-collaboration-user-store.h
+++ b/src/gedit-collaboration-user-store.h
@@ -8,15 +8,15 @@
G_BEGIN_DECLS
-#define GEDIT_COLLABORATION_TYPE_USER_STORE (gedit_collaboration_user_store_get_type ())
-#define GEDIT_COLLABORATION_USER_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_USER_STORE, GeditCollaborationUserStore))
-#define GEDIT_COLLABORATION_USER_STORE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_USER_STORE, GeditCollaborationUserStore const))
-#define GEDIT_COLLABORATION_USER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_USER_STORE, GeditCollaborationUserStoreClass))
-#define GEDIT_COLLABORATION_IS_USER_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_USER_STORE))
+#define GEDIT_COLLABORATION_TYPE_USER_STORE (gedit_collaboration_user_store_get_type ())
+#define GEDIT_COLLABORATION_USER_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_USER_STORE, GeditCollaborationUserStore))
+#define GEDIT_COLLABORATION_USER_STORE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_COLLABORATION_TYPE_USER_STORE, GeditCollaborationUserStore const))
+#define GEDIT_COLLABORATION_USER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_COLLABORATION_TYPE_USER_STORE, GeditCollaborationUserStoreClass))
+#define GEDIT_COLLABORATION_IS_USER_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_COLLABORATION_TYPE_USER_STORE))
#define GEDIT_COLLABORATION_IS_USER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_COLLABORATION_TYPE_USER_STORE))
#define GEDIT_COLLABORATION_USER_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_COLLABORATION_TYPE_USER_STORE, GeditCollaborationUserStoreClass))
-typedef struct _GeditCollaborationUserStore GeditCollaborationUserStore;
+typedef struct _GeditCollaborationUserStore GeditCollaborationUserStore;
typedef struct _GeditCollaborationUserStoreClass GeditCollaborationUserStoreClass;
typedef struct _GeditCollaborationUserStorePrivate GeditCollaborationUserStorePrivate;
@@ -25,18 +25,20 @@ typedef enum
GEDIT_COLLABORATION_USER_STORE_COLUMN_USER
} GeditCollaborationUserStoreColumn;
-struct _GeditCollaborationUserStore {
+struct _GeditCollaborationUserStore
+{
GtkListStore parent;
GeditCollaborationUserStorePrivate *priv;
};
-struct _GeditCollaborationUserStoreClass {
+struct _GeditCollaborationUserStoreClass
+{
GtkListStoreClass parent_class;
};
GType gedit_collaboration_user_store_get_type (void) G_GNUC_CONST;
-GType gedit_collaboration_user_store_register_type (GTypeModule *type_module);
+void _gedit_collaboration_user_store_register_type (GTypeModule *type_module);
GeditCollaborationUserStore *gedit_collaboration_user_store_new (InfUserTable *user_table,
gboolean show_unavailable);
diff --git a/src/gedit-collaboration-user.c b/src/gedit-collaboration-user.c
index 582ee2a..a3a42d2 100644
--- a/src/gedit-collaboration-user.c
+++ b/src/gedit-collaboration-user.c
@@ -3,15 +3,14 @@
#include "gedit-collaboration-user.h"
#include "gedit-collaboration.h"
-#include <gconf/gconf-client.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define GEDIT_COLLABORATION_USER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GEDIT_COLLABORATION_TYPE_USER, GeditCollaborationUserPrivate))
-#define DEFAULT_USER_BASE_KEY "/apps/gedit-2/plugins/collaboration/user"
-#define GCONF_CLIENT_DATA_KEY "GeditCollaborationUserGconfClientKey"
+#define COLLABORATION_USER_SETTINGS "org.gnome.gedit.plugins.collaboration.user"
+#define SETTINGS_DATA_KEY "GeditCollaborationUserSettingsKey"
static GeditCollaborationUser *default_user = NULL;
@@ -54,6 +53,14 @@ gedit_collaboration_user_finalize (GObject *object)
G_OBJECT_CLASS (gedit_collaboration_user_parent_class)->finalize (object);
}
+static gdouble
+random_hue ()
+{
+ /* Generate random hue */
+ srand (time (0));
+ return random () / (gdouble)RAND_MAX;
+}
+
static void
gedit_collaboration_user_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
@@ -248,6 +255,7 @@ gedit_collaboration_user_set_hue (GeditCollaborationUser *user,
gdouble hue)
{
g_return_if_fail (GEDIT_COLLABORATION_IS_USER (user));
+ g_return_if_fail (hue >= 0 && hue <= 1);
if (fabs (user->priv->hue - hue) > 1e-7)
{
@@ -255,164 +263,71 @@ gedit_collaboration_user_set_hue (GeditCollaborationUser *user,
}
}
-static void
-on_default_user_notify_hue (GeditCollaborationUser *user)
-{
- GConfClient *client = g_object_get_data (G_OBJECT (user),
- GCONF_CLIENT_DATA_KEY);
-
- gconf_client_set_float (client,
- DEFAULT_USER_BASE_KEY "/hue",
- user->priv->hue,
- NULL);
-}
-
-static void
-on_default_user_notify_name (GeditCollaborationUser *user)
-{
- GConfClient *client = g_object_get_data (G_OBJECT (user),
- GCONF_CLIENT_DATA_KEY);
-
- gconf_client_set_string (client,
- DEFAULT_USER_BASE_KEY "/name",
- user->priv->name,
- NULL);
-}
-
-static void
-on_default_user_client_notify (GConfClient *client,
- guint cnxnid,
- GConfEntry *entry)
+gboolean
+name_get_mapping (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
{
- const gchar *key;
- GConfValue *value;
+ gchar *name;
+ gsize length;
- key = gconf_entry_get_key (entry);
- value = gconf_entry_get_value (entry);
+ name = g_variant_dup_string (variant, &length);
- if (value == NULL)
+ if (!name || !*name)
{
- return;
- }
-
- if (strcmp (entry->key, DEFAULT_USER_BASE_KEY "/name") == 0)
- {
- gedit_collaboration_user_set_name (default_user,
- gconf_value_get_string (value));
+ g_free (name);
+ name = g_strdup (g_get_user_name ());
}
- else if (strcmp (entry->key, DEFAULT_USER_BASE_KEY "/hue") == 0)
- {
- gdouble val = gconf_value_get_float (value);
- gboolean isrand = FALSE;
- if (val < 0)
- {
- srand (time (0));
- val = random() / (gdouble)RAND_MAX;
-
- isrand = TRUE;
- }
-
- gedit_collaboration_user_set_hue (default_user,
- val);
-
- if (isrand)
- {
- gconf_client_set_float (client,
- DEFAULT_USER_BASE_KEY "/hue",
- val,
- NULL);
- }
- }
+ g_value_take_string (value, name);
+ return TRUE;
}
GeditCollaborationUser *
gedit_collaboration_user_get_default ()
{
- if (default_user == NULL)
- {
- GConfClient *client = gconf_client_get_default ();
- gdouble hue = -1;
- gchar *name = NULL;
- GConfValue *value;
- gboolean israndom = FALSE;
-
- value = gconf_client_get (client,
- DEFAULT_USER_BASE_KEY "/hue",
- NULL);
-
- if (value != NULL)
- {
- hue = gconf_value_get_float (value);
- gconf_value_free (value);
- }
-
- if (hue < 0)
- {
- /* Generate random hue */
- israndom = TRUE;
- srand (time (0));
-
- hue = random () / (double)RAND_MAX;
- }
-
- value = gconf_client_get (client,
- DEFAULT_USER_BASE_KEY "/name",
- NULL);
-
- if (value != NULL)
- {
- name = g_strdup (gconf_value_get_string (value));
- gconf_value_free (value);
- }
-
- if (!name || !*name)
- {
- g_free (name);
- name = g_strdup (g_get_user_name ());
- }
-
- default_user = gedit_collaboration_user_new (name);
- gedit_collaboration_user_set_hue (default_user, hue);
- g_free (name);
+ gdouble hue = -1;
+ GSettings *user_settings;
- g_object_set_data_full (G_OBJECT (default_user),
- GCONF_CLIENT_DATA_KEY,
- client,
- (GDestroyNotify)g_object_unref);
+ if (default_user != NULL)
+ {
+ return default_user;
+ }
- /* Make sure to save hue to gconf if it was randomly initialized */
- if (israndom)
- {
- on_default_user_notify_hue (default_user);
- }
+ user_settings = g_settings_new (COLLABORATION_USER_SETTINGS);
+ hue = g_settings_get_double (user_settings, "hue");
- gconf_client_add_dir (client,
- DEFAULT_USER_BASE_KEY,
- GCONF_CLIENT_PRELOAD_ONELEVEL,
- NULL);
-
- gconf_client_notify_add (client,
- DEFAULT_USER_BASE_KEY,
- (GConfClientNotifyFunc)on_default_user_client_notify,
- NULL,
- NULL,
- NULL);
-
- g_signal_connect (default_user,
- "notify::hue",
- G_CALLBACK (on_default_user_notify_hue),
- NULL);
-
- g_signal_connect (default_user,
- "notify::name",
- G_CALLBACK (on_default_user_notify_name),
- NULL);
-
- g_object_add_weak_pointer (G_OBJECT (default_user),
- (gpointer *)&default_user);
+ if (hue < 0)
+ {
+ g_settings_set_double (user_settings, "hue", random_hue ());
}
+ default_user = gedit_collaboration_user_new (NULL);
+
+ g_object_set_data_full (G_OBJECT (default_user),
+ SETTINGS_DATA_KEY,
+ user_settings,
+ (GDestroyNotify)g_object_unref);
+
+ g_settings_bind_with_mapping (user_settings,
+ "name",
+ default_user,
+ "name",
+ G_SETTINGS_BIND_DEFAULT,
+ name_get_mapping,
+ NULL,
+ NULL,
+ NULL);
+
+ g_settings_bind (user_settings,
+ "hue",
+ default_user,
+ "hue",
+ G_SETTINGS_BIND_DEFAULT);
+
+ g_object_add_weak_pointer (G_OBJECT (default_user),
+ (gpointer *)&default_user);
+
return default_user;
}
diff --git a/src/gedit-collaboration-window-helper-private.h b/src/gedit-collaboration-window-helper-private.h
index 50fabcb..38dc4f1 100644
--- a/src/gedit-collaboration-window-helper-private.h
+++ b/src/gedit-collaboration-window-helper-private.h
@@ -5,7 +5,7 @@
#include <config.h>
#include <glib/gi18n-lib.h>
-#include <gedit/gedit-plugin.h>
+#include <gedit/gedit-window.h>
#include <libinfgtk/inf-gtk-browser-view.h>
#include <libinfgtk/inf-gtk-browser-store.h>
diff --git a/src/gedit-collaboration-window-helper.c b/src/gedit-collaboration-window-helper.c
index 03bb65e..a2e967c 100644
--- a/src/gedit-collaboration-window-helper.c
+++ b/src/gedit-collaboration-window-helper.c
@@ -1,5 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+#include <gedit/gedit-window-activatable.h>
+
#include "gedit-collaboration-window-helper.h"
#include "gedit-collaboration-bookmarks.h"
#include "gedit-collaboration-bookmark-dialog.h"
@@ -24,12 +26,23 @@
enum
{
PROP_0,
- PROP_WINDOW,
- PROP_DATA_DIR
+ PROP_WINDOW
};
-GEDIT_PLUGIN_DEFINE_TYPE (GeditCollaborationWindowHelper, gedit_collaboration_window_helper,
- G_TYPE_OBJECT)
+static void gedit_window_activatable_iface_init (GeditWindowActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditCollaborationWindowHelper,
+ gedit_collaboration_window_helper,
+ PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (GEDIT_TYPE_WINDOW_ACTIVATABLE,
+ gedit_window_activatable_iface_init))
+
+static void
+gedit_window_activatable_iface_init (GeditWindowActivatableInterface *iface)
+{
+ /* TODO */
+}
static GdkPixbuf *
try_create_icon (const gchar *data_dir)
@@ -52,8 +65,11 @@ create_collaboration_image (GeditCollaborationWindowHelper *helper)
{
GdkPixbuf *icon;
GtkWidget *image;
+ gchar *datadir;
- icon = try_create_icon (helper->priv->data_dir);
+ datadir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (helper));
+ icon = try_create_icon (datadir);
+ g_free (datadir);
if (icon == NULL)
{
@@ -324,10 +340,6 @@ gedit_collaboration_window_helper_set_property (GObject *object,
case PROP_WINDOW:
set_window (self, g_value_get_object (value));
break;
- case PROP_DATA_DIR:
- g_free (self->priv->data_dir);
- self->priv->data_dir = g_value_dup_string (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -347,9 +359,6 @@ gedit_collaboration_window_helper_get_property (GObject *object,
case PROP_WINDOW:
g_value_set_object (value, self->priv->window);
break;
- case PROP_DATA_DIR:
- g_value_set_string (value, self->priv->data_dir);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -678,7 +687,11 @@ sync_completed (InfSession *session,
panel = gedit_window_get_bottom_panel (cdata->helper->priv->window);
image = create_collaboration_image (cdata->helper);
- gedit_panel_add_item (panel, hpaned, chat_name ? chat_name : _("Chat"), image);
+ gedit_panel_add_item (panel,
+ hpaned,
+ "GeditCollaborationChat",
+ chat_name ? chat_name : _("Chat"),
+ image);
g_object_set_data (G_OBJECT (connection), CHAT_DATA_KEY, hpaned);
cdata->user = gedit_collaboration_user_get_name (user);
@@ -874,9 +887,12 @@ show_password_dialog (GeditCollaborationWindowHelper *helper,
gchar *name;
gchar *username;
gchar *remotename;
+ gchar *datadir;
- builder = gedit_collaboration_create_builder (helper->priv->data_dir,
+ datadir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (helper));
+ builder = gedit_collaboration_create_builder (datadir,
"gedit-collaboration-password-dialog.ui");
+ g_free (datadir);
if (!builder)
{
@@ -1471,9 +1487,11 @@ build_ui (GeditCollaborationWindowHelper *helper)
GtkWidget *image;
GtkBuilder *builder;
GtkWidget *paned;
+ gchar *datadir;
- builder = gedit_collaboration_create_builder (helper->priv->data_dir,
- XML_UI_FILE);
+ datadir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (helper));
+ builder = gedit_collaboration_create_builder (datadir, XML_UI_FILE);
+ g_free (datadir);
if (!builder)
{
@@ -1539,7 +1557,12 @@ build_ui (GeditCollaborationWindowHelper *helper)
FALSE,
NULL);
- gedit_panel_add_item (panel, paned, _("Collaboration"), image);
+ gedit_panel_add_item (panel,
+ paned,
+ "GeditCollaborationPanel",
+ _("Collaboration"),
+ image);
+
helper->priv->panel_widget = paned;
g_signal_connect_after (paned,
@@ -1603,31 +1626,18 @@ gedit_collaboration_window_helper_class_init (GeditCollaborationWindowHelperClas
GEDIT_TYPE_WINDOW,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class,
- PROP_DATA_DIR,
- g_param_spec_string ("data-dir",
- "Data Dir",
- "Data dir",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
g_type_class_add_private (object_class, sizeof(GeditCollaborationWindowHelperPrivate));
}
static void
-gedit_collaboration_window_helper_init (GeditCollaborationWindowHelper *self)
+gedit_collaboration_window_helper_class_finalize (GeditCollaborationWindowHelperClass *klass)
{
- self->priv = GEDIT_COLLABORATION_WINDOW_HELPER_GET_PRIVATE (self);
}
-GeditCollaborationWindowHelper *
-gedit_collaboration_window_helper_new (GeditWindow *window,
- const gchar *data_dir)
+static void
+gedit_collaboration_window_helper_init (GeditCollaborationWindowHelper *self)
{
- return g_object_new (GEDIT_TYPE_COLLABORATION_WINDOW_HELPER,
- "window", window,
- "data-dir", data_dir,
- NULL);
+ self->priv = GEDIT_COLLABORATION_WINDOW_HELPER_GET_PRIVATE (self);
}
void
@@ -1650,3 +1660,9 @@ gedit_collaboration_window_helper_update_ui (GeditCollaborationWindowHelper *hel
gtk_action_set_sensitive (action, sensitive);
}
+
+void
+_gedit_collaboration_window_helper_register_type (GTypeModule *module)
+{
+ gedit_collaboration_window_helper_register_type (module);
+}
diff --git a/src/gedit-collaboration-window-helper.h b/src/gedit-collaboration-window-helper.h
index 48e6d66..d1f29c5 100644
--- a/src/gedit-collaboration-window-helper.h
+++ b/src/gedit-collaboration-window-helper.h
@@ -5,38 +5,37 @@
#include <glib-object.h>
#include <gedit/gedit-window.h>
+#include <libpeas/peas-extension-base.h>
G_BEGIN_DECLS
-#define GEDIT_TYPE_COLLABORATION_WINDOW_HELPER (gedit_collaboration_window_helper_get_type ())
-#define GEDIT_COLLABORATION_WINDOW_HELPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_COLLABORATION_WINDOW_HELPER, GeditCollaborationWindowHelper))
+#define GEDIT_TYPE_COLLABORATION_WINDOW_HELPER (gedit_collaboration_window_helper_get_type ())
+#define GEDIT_COLLABORATION_WINDOW_HELPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_COLLABORATION_WINDOW_HELPER, GeditCollaborationWindowHelper))
#define GEDIT_COLLABORATION_WINDOW_HELPER_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_COLLABORATION_WINDOW_HELPER, GeditCollaborationWindowHelper const))
#define GEDIT_COLLABORATION_WINDOW_HELPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_COLLABORATION_WINDOW_HELPER, GeditCollaborationWindowHelperClass))
-#define GEDIT_IS_COLLABORATION_WINDOW_HELPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_COLLABORATION_WINDOW_HELPER))
+#define GEDIT_IS_COLLABORATION_WINDOW_HELPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_COLLABORATION_WINDOW_HELPER))
#define GEDIT_IS_COLLABORATION_WINDOW_HELPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_COLLABORATION_WINDOW_HELPER))
#define GEDIT_COLLABORATION_WINDOW_HELPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_COLLABORATION_WINDOW_HELPER, GeditCollaborationWindowHelperClass))
-typedef struct _GeditCollaborationWindowHelper GeditCollaborationWindowHelper;
-typedef struct _GeditCollaborationWindowHelperClass GeditCollaborationWindowHelperClass;
+typedef struct _GeditCollaborationWindowHelper GeditCollaborationWindowHelper;
+typedef struct _GeditCollaborationWindowHelperClass GeditCollaborationWindowHelperClass;
typedef struct _GeditCollaborationWindowHelperPrivate GeditCollaborationWindowHelperPrivate;
-struct _GeditCollaborationWindowHelper {
- GObject parent;
+struct _GeditCollaborationWindowHelper
+{
+ PeasExtensionBase parent;
GeditCollaborationWindowHelperPrivate *priv;
};
-struct _GeditCollaborationWindowHelperClass {
- GObjectClass parent_class;
+struct _GeditCollaborationWindowHelperClass
+{
+ PeasExtensionBaseClass parent_class;
};
GType gedit_collaboration_window_helper_get_type (void) G_GNUC_CONST;
-GeditCollaborationWindowHelper *gedit_collaboration_window_helper_new (GeditWindow *window,
- const gchar *data_dir);
-GType gedit_collaboration_window_helper_register_type (GTypeModule *module);
-
-void gedit_collaboration_window_helper_update_ui (GeditCollaborationWindowHelper *helper);
+void _gedit_collaboration_window_helper_register_type (GTypeModule *module);
G_END_DECLS