gtranslator r3554 - in trunk: . data plugins plugins/fullscreen



Author: icq
Date: Tue Apr  8 15:03:09 2008
New Revision: 3554
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3554&view=rev

Log:
2008-04-08  Ignacio Casal Quinteiro  <nacho resa gmail com>

        * plugins/fullscreen/*
        * configure.ac:
        * data/gtranslator-ui.xml:
        Added fullscreen plugin.



Added:
   trunk/plugins/fullscreen/
   trunk/plugins/fullscreen/Makefile.am
   trunk/plugins/fullscreen/fullscreen-plugin.c
   trunk/plugins/fullscreen/fullscreen-plugin.h
   trunk/plugins/fullscreen/fullscreen.gtranslator-plugin.desktop.in
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/data/gtranslator-ui.xml
   trunk/plugins/Makefile.am

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Tue Apr  8 15:03:09 2008
@@ -288,8 +288,9 @@
 plugins/alternate-language/Makefile
 plugins/charmap/Makefile
 plugins/dictionary/Makefile
-plugins/open-tran/Makefile
+plugins/fullscreen/Makefile
 plugins/insert-tags/Makefile
+plugins/open-tran/Makefile
 src/Makefile
 src/dialogs/Makefile
 src/toolbareditor/Makefile

Modified: trunk/data/gtranslator-ui.xml
==============================================================================
--- trunk/data/gtranslator-ui.xml	(original)
+++ trunk/data/gtranslator-ui.xml	Tue Apr  8 15:03:09 2008
@@ -36,6 +36,9 @@
     </menu>
 
     <menu name="ViewMenu" action="View">
+      <separator/>
+      <placeholder name="ViewOps_1" />
+      <separator/>
       <menuitem name="ViewSidePaneMenu" action="ViewSidePane"/>
     </menu>
 

Modified: trunk/plugins/Makefile.am
==============================================================================
--- trunk/plugins/Makefile.am	(original)
+++ trunk/plugins/Makefile.am	Tue Apr  8 15:03:09 2008
@@ -1,5 +1,6 @@
 SUBDIRS = 					\
 	alternate-language			\
+	fullscreen				\
 	insert-tags
 
 if USE_CHARMAP

Added: trunk/plugins/fullscreen/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/plugins/fullscreen/Makefile.am	Tue Apr  8 15:03:09 2008
@@ -0,0 +1,38 @@
+# FullScreen plugin
+plugindir = $(libdir)/gtranslator/plugins
+
+INCLUDES = \
+	-I$(top_srcdir) 				\
+	-I$(top_srcdir)/src				\
+	-I$(top_srcdir)/src/plugin-system		\
+	-I$(top_srcdir)/src/dialogs			\
+	$(GTRANSLATOR_CFLAGS) 				\
+	$(WARN_CFLAGS)					\
+	$(DISABLE_DEPRECATED_CFLAGS)			\
+	-DGTR_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
+
+plugin_LTLIBRARIES = \
+	libfullscreen.la
+
+libfullscreen_la_SOURCES = \
+	fullscreen-plugin.c \
+	fullscreen-plugin.h
+
+
+libfullscreen_la_LDFLAGS = \
+	$(PLUGIN_LIBTOOL_FLAGS)				\
+	$(GTRANSLATOR_LIBS)
+
+# Plugin Info
+
+plugin_in_files = fullscreen.gtranslator-plugin.desktop.in
+
+%.gtranslator.plugin: %.gtranslator-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.gtranslator-plugin.desktop.in=.gtranslator.plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
+

Added: trunk/plugins/fullscreen/fullscreen-plugin.c
==============================================================================
--- (empty file)
+++ trunk/plugins/fullscreen/fullscreen-plugin.c	Tue Apr  8 15:03:09 2008
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2008  Ignacio Casal Quinteiro <nacho resa gmail com>
+ * 
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU General Public License as published by
+ *     the Free Software Foundation, either version 3 of the License, or
+ *     (at your option) any later version.
+ * 
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANPOILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ * 
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "fullscreen-plugin.h"
+#include "window.h"
+
+#include <glib/gi18n-lib.h>
+#include <gtk/gtk.h>
+#include <string.h>
+
+#define WINDOW_DATA_KEY "GtranslatorFullscreenPluginWindowData"
+#define MENU_PATH "/MainMenu/ViewMenu/ViewOps_1"
+
+GTR_PLUGIN_REGISTER_TYPE(GtranslatorFullscreenPlugin, gtranslator_fullscreen_plugin)
+
+static void
+on_fullscreen_activated (GtkToggleAction *action,
+			 GtranslatorWindow *window)
+{
+	if (gtk_toggle_action_get_active (action))
+		gtk_window_fullscreen (GTK_WINDOW (window));
+	else gtk_window_unfullscreen (GTK_WINDOW (window));
+}
+
+static const GtkToggleActionEntry action_entries[] =
+{
+	{ "Fullscreen", NULL, N_("_Fullscreen"), NULL,
+	 N_("Place window on fullscreen state"),
+	 G_CALLBACK (on_fullscreen_activated)}, 
+};
+
+typedef struct
+{
+	GtkActionGroup *action_group;
+	guint           ui_id;
+} WindowData;
+
+static void
+free_window_data (WindowData *data)
+{
+	g_return_if_fail (data != NULL);
+
+	g_free (data);
+}
+
+static void
+gtranslator_fullscreen_plugin_init (GtranslatorFullscreenPlugin *message_table)
+{
+}
+
+static void
+gtranslator_fullscreen_plugin_finalize (GObject *object)
+{
+	G_OBJECT_CLASS (gtranslator_fullscreen_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (GtranslatorPlugin *plugin,
+	       GtranslatorWindow *window)
+{
+	GtkUIManager *manager;
+	WindowData *data;
+	GError *error = NULL;
+	
+	g_return_if_fail (GTR_IS_WINDOW (window));
+
+	data = g_new (WindowData, 1);
+
+	manager = gtranslator_window_get_ui_manager (window);
+
+	data->action_group = gtk_action_group_new ("GtranslatorFullscreenPluginActions");
+	gtk_action_group_set_translation_domain (data->action_group, 
+						 GETTEXT_PACKAGE);
+	gtk_action_group_add_toggle_actions (data->action_group,
+					     action_entries,
+					     G_N_ELEMENTS (action_entries), 
+					     window);
+
+	gtk_ui_manager_insert_action_group (manager, data->action_group, -1);
+
+	data->ui_id = gtk_ui_manager_new_merge_id (manager);
+	
+	if (data->ui_id == 0)
+	{
+		g_warning (error->message);
+		return;
+	}
+
+	g_object_set_data_full (G_OBJECT (window), 
+				WINDOW_DATA_KEY, 
+				data,
+				(GDestroyNotify) free_window_data);
+	
+	gtk_ui_manager_add_ui (manager,
+			       data->ui_id,
+			       MENU_PATH,
+			       "Fullscreen",
+			       "Fullscreen",
+			       GTK_UI_MANAGER_MENUITEM,
+			       FALSE);
+}
+
+static void
+impl_deactivate(GtranslatorPlugin *plugin,
+	        GtranslatorWindow *window)
+{
+	GtkUIManager *manager;
+	WindowData *data;
+	
+	manager = gtranslator_window_get_ui_manager (window);
+
+	data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
+	g_return_if_fail (data != NULL);
+
+	gtk_ui_manager_remove_ui (manager, data->ui_id);
+	gtk_ui_manager_remove_action_group (manager, data->action_group);
+
+	g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);	
+}
+
+static void
+gtranslator_fullscreen_plugin_class_init (GtranslatorFullscreenPluginClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	GtranslatorPluginClass *plugin_class = GTR_PLUGIN_CLASS (klass);
+
+	object_class->finalize = gtranslator_fullscreen_plugin_finalize;
+
+	plugin_class->activate = impl_activate;
+	plugin_class->deactivate = impl_deactivate;
+}

Added: trunk/plugins/fullscreen/fullscreen-plugin.h
==============================================================================
--- (empty file)
+++ trunk/plugins/fullscreen/fullscreen-plugin.h	Tue Apr  8 15:03:09 2008
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2008  Ignacio Casal Quinteiro <nacho resa gmail com>
+ * 
+ *     This program is free software: you can redistribute it and/or modify
+ *     it under the terms of the GNU General Public License as published by
+ *     the Free Software Foundation, either version 3 of the License, or
+ *     (at your option) any later version.
+ * 
+ *     This program is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANPOILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ * 
+ *     You should have received a copy of the GNU General Public License
+ *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __GTR_FULLSCREEN_PLUGIN_H__
+#define __GTR_FULLSCREEN_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "plugin.h"
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define GTR_TYPE_FULLSCREEN_PLUGIN		(gtranslator_fullscreen_get_type ())
+#define GTR_FULLSCREEN_PLUGIN(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GTR_TYPE_MESSAGEFULLSCREEN_PLUGIN, GtranslatorFullscreenPlugin))
+#define GTR_FULLSCREEN_PLUGIN_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GTR_TYPE_FULLSCREEN_PLUGIN, GtranslatorFullscreenPluginClass))
+#define GTR_IS_FULLSCREEN_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GTR_TYPE_FULLSCREEN_PLUGIN))
+#define GTR_IS_FULLSCREEN_PLUGIN_CLASS(k)		(G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_FULLSCREEN_PLUGIN))
+#define GTR_FULLSCREEN_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_FULLSCREEN_PLUGIN_PLUGIN, GtranslatorFullscreenPluginClass))
+
+/* Private structure type */
+typedef struct _GtranslatorFullscreenPluginPrivate	GtranslatorFullscreenPluginPrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _GtranslatorFullscreenPlugin		GtranslatorFullscreenPlugin;
+
+struct _GtranslatorFullscreenPlugin
+{
+	GtranslatorPlugin parent_instance;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _GtranslatorFullscreenPluginClass	GtranslatorFullscreenPluginClass;
+
+struct _GtranslatorFullscreenPluginClass
+{
+	GtranslatorPluginClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType	gtranslator_fullscreen_plugin_get_type	(void) G_GNUC_CONST;
+
+/* All the plugins must implement this function */
+G_MODULE_EXPORT GType register_gtranslator_plugin (GTypeModule *module);
+
+G_END_DECLS
+
+#endif /* __GTR_FULLSCREEN_PLUGIN_H__ */

Added: trunk/plugins/fullscreen/fullscreen.gtranslator-plugin.desktop.in
==============================================================================
--- (empty file)
+++ trunk/plugins/fullscreen/fullscreen.gtranslator-plugin.desktop.in	Tue Apr  8 15:03:09 2008
@@ -0,0 +1,8 @@
+[Gtranslator Plugin]
+Module=fullscreen
+IAge=2
+_Name=Fullscreen
+_Description=Place window in the fullscreen state.
+Authors=Ignacio Casal Quinteiro  <nacho resa gmail com>
+Copyright=Copyright @ 2008 Ignacio Casal Quinteiro
+Website=http://gtranslator.sf.net



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]