gtranslator r3658 - in trunk: . plugins/dictionary



Author: icq
Date: Mon Sep 22 09:41:25 2008
New Revision: 3658
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3658&view=rev

Log:
Conflicts:

	ChangeLog

Added:
   trunk/plugins/dictionary/gnome-dictionary.png
Modified:
   trunk/ChangeLog
   trunk/plugins/dictionary/Makefile.am
   trunk/plugins/dictionary/dict-panel.c
   trunk/plugins/dictionary/dict-panel.h
   trunk/plugins/dictionary/dict.gtranslator-plugin.desktop.in
   trunk/plugins/dictionary/dictionary-plugin.c
   trunk/plugins/dictionary/gdict-sidebar.c

Modified: trunk/plugins/dictionary/Makefile.am
==============================================================================
--- trunk/plugins/dictionary/Makefile.am	(original)
+++ trunk/plugins/dictionary/Makefile.am	Mon Sep 22 09:41:25 2008
@@ -28,6 +28,11 @@
 	$(GTRANSLATOR_LIBS)					\
 	$(DICTIONARY_LIBS)
 
+pixmaps_dir = $(datadir)/pixmaps/gtranslator
+pixmaps__DATA = \
+        gnome-dictionary.png
+
+
 # Plugin Info
 
 plugin_in_files = dict.gtranslator-plugin.desktop.in

Modified: trunk/plugins/dictionary/dict-panel.c
==============================================================================
--- trunk/plugins/dictionary/dict-panel.c	(original)
+++ trunk/plugins/dictionary/dict-panel.c	Mon Sep 22 09:41:25 2008
@@ -22,6 +22,9 @@
 #include "dict-panel.h"
 #include "gdict-sidebar.h"
 #include "plugin.h"
+#include "window.h"
+#include "statusbar.h"
+#include "utils.h"
 
 #include <glib.h>
 #include <glib-object.h>
@@ -36,24 +39,25 @@
 						 GTR_TYPE_DICT_PANEL,     \
 						 GtranslatorDictPanelPrivate))
 
-#define GDICT_GCONF_DIR                     "/apps/gnome-dictionary"
-#define GDICT_GCONF_DATABASE_KEY            GDICT_GCONF_DIR "/database"
-#define GDICT_GCONF_STRATEGY_KEY            GDICT_GCONF_DIR "/strategy"
-#define GDICT_DEFAULT_SOURCE_NAME           "Default"
-#define GDICT_GCONF_SOURCE_KEY              GDICT_GCONF_DIR "/source-name"
-
-#define PANEL_KEY "/apps/gtranslator/plugins/dictionary"
+#define DICTIONARY_GCONF_DIR                     "/apps/gtranslator/plugins/dictionary"
+#define DICTIONARY_GCONF_DATABASE_KEY            DICTIONARY_GCONF_DIR "/database"
+#define DICTIONARY_GCONF_STRATEGY_KEY            DICTIONARY_GCONF_DIR "/strategy"
+#define DICTIONARY_DEFAULT_SOURCE_NAME           "Default"
+#define DICTIONARY_GCONF_SOURCE_KEY              DICTIONARY_GCONF_DIR "/source-name"
+#define DICTIONARY_GCONF_POSITION_KEY            DICTIONARY_GCONF_DIR "/panel_position"
 
 /* sidebar pages logical ids */
 #define GDICT_SIDEBAR_SPELLER_PAGE      "speller"
 #define GDICT_SIDEBAR_DATABASES_PAGE    "db-chooser"
 #define GDICT_SIDEBAR_STRATEGIES_PAGE   "strat-chooser"
+#define GDICT_SIDEBAR_SOURCES_PAGE      "source-chooser"
 
 GTR_PLUGIN_DEFINE_TYPE(GtranslatorDictPanel, gtranslator_dict_panel, GTK_TYPE_VBOX)
 
 struct _GtranslatorDictPanelPrivate
 {
 	GtkPaned   *paned;
+	GtranslatorStatusbar *status;
   
 	GConfClient *gconf_client;
 	guint notify_id;
@@ -64,33 +68,39 @@
 
 	gchar *word;  
 	GdictContext *context;
-	guint lookup_start_id;
-	guint lookup_end_id;
-	guint error_id;
 
 	GdictSourceLoader *loader;
 
 	GtkWidget *speller;
 	GtkWidget *db_chooser;
 	GtkWidget *strat_chooser;
+	GtkWidget *source_chooser;
 	GtkWidget *entry;
 	GtkWidget *button;
 	GtkWidget *defbox;
 	GtkWidget *sidebar;
 };
 
-
-static gchar *
-gdict_get_data_dir (void)
+static void
+gtranslator_dict_panel_create_warning_dialog (const gchar *primary,
+					      const gchar *secondary)
 {
-	gchar *retval;
+	GtkWidget *dialog;
 	
-	retval = g_build_filename (g_get_home_dir (),
-				   ".gnome2",
-				   "gnome-dictionary",
-				   NULL);
-
-	return retval;
+	if (!primary)
+		return;
+	
+	dialog = gtk_message_dialog_new (NULL,
+					 GTK_DIALOG_DESTROY_WITH_PARENT,
+					 GTK_MESSAGE_WARNING,
+					 GTK_BUTTONS_CLOSE,
+					 primary);
+	
+	if (secondary)
+		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+							  secondary);
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
 }
 
 static gchar *
@@ -134,7 +144,7 @@
 		priv->database = g_strdup (database);
 	else
 		priv->database = gdict_gconf_get_string_with_default (priv->gconf_client,
-								      GDICT_GCONF_DATABASE_KEY,
+								      DICTIONARY_GCONF_DATABASE_KEY,
 								      GDICT_DEFAULT_DATABASE);
 	if (priv->defbox)
 		gdict_defbox_set_database (GDICT_DEFBOX (priv->defbox),
@@ -153,7 +163,7 @@
 		priv->strategy = g_strdup (strategy);
 	else
 		priv->strategy = gdict_gconf_get_string_with_default (priv->gconf_client,
-								      GDICT_GCONF_STRATEGY_KEY,
+								      DICTIONARY_GCONF_STRATEGY_KEY,
 								      GDICT_DEFAULT_STRATEGY);
 }
 
@@ -165,7 +175,7 @@
 	GdictContext *retval;
 
 	if (!priv->source_name)
-		priv->source_name = g_strdup (GDICT_DEFAULT_SOURCE_NAME);
+		priv->source_name = g_strdup (DICTIONARY_DEFAULT_SOURCE_NAME);
 
 	source = gdict_source_loader_get_source (priv->loader,
 						 priv->source_name);
@@ -175,8 +185,9 @@
 		
 		detail = g_strdup_printf (_("No dictionary source available with name '%s'"),
 					  priv->source_name);
-
-		g_warning(_("Unable to find dictionary source"));
+		
+		gtranslator_dict_panel_create_warning_dialog (_("Unable to find dictionary source"),
+							      detail);
 		g_free (detail);
 
 		return NULL;
@@ -192,11 +203,9 @@
 
 		detail = g_strdup_printf (_("No context available for source '%s'"),
 					  gdict_source_get_description (source));
-      				
-      /*gdict_show_error_dialog (NULL,
-                               _("Unable to create a context"),
-                               detail);*/
-		g_warning(_("Unable to create a context"));
+		
+		gtranslator_dict_panel_create_warning_dialog (_("Unable to create a context"),
+							      detail);
 
 		g_free (detail);
 		g_object_unref (source);
@@ -216,15 +225,7 @@
 	GtranslatorDictPanelPrivate *priv = panel->priv;
 
 	if (priv->context)
-	{
-		g_signal_handler_disconnect (priv->context, priv->lookup_start_id);
-		g_signal_handler_disconnect (priv->context, priv->lookup_end_id);
-		g_signal_handler_disconnect (priv->context, priv->error_id);
-
-		priv->lookup_start_id = 0;
-		priv->lookup_end_id = 0;
-		priv->error_id = 0;
-		
+	{	
 		g_object_unref (priv->context);
 		priv->context = NULL;
 	}
@@ -232,20 +233,15 @@
 	if (priv->defbox)
 		gdict_defbox_set_context (GDICT_DEFBOX (priv->defbox), context);
 	
+	if (priv->db_chooser)
+		gdict_database_chooser_set_context (GDICT_DATABASE_CHOOSER (priv->db_chooser), context);
+	
+	if (priv->strat_chooser)
+		gdict_strategy_chooser_set_context (GDICT_STRATEGY_CHOOSER (priv->strat_chooser), context);
+	
 	if (!context)
 		return;
 	
-	/* attach our callbacks */
-	/* priv->lookup_start_id = g_signal_connect (context, "lookup-start",
-					    G_CALLBACK (gdict_applet_lookup_start_cb),
-					    panel);
-  priv->lookup_end_id   = g_signal_connect (context, "lookup-end",
-					    G_CALLBACK (gdict_applet_lookup_end_cb),
-					    panel);*/
-  /*priv->error_id        = g_signal_connect (context, "error",
-		  			    G_CALLBACK (gdict_applet_error_cb),
-					    panel);*/
-
 	priv->context = context;
 }
 
@@ -256,17 +252,46 @@
 	GtranslatorDictPanelPrivate *priv = panel->priv;
 	GdictContext *context;
 	
+	if (priv->source_name && source_name &&
+	    strcmp (priv->source_name, source_name) == 0)
+		return;
+	
 	g_free (priv->source_name);
 	
 	if (source_name)
 		priv->source_name = g_strdup (source_name);
 	else
 		priv->source_name = gdict_gconf_get_string_with_default (priv->gconf_client,
-									 GDICT_GCONF_SOURCE_KEY,
-									 GDICT_DEFAULT_SOURCE_NAME);
+									 DICTIONARY_GCONF_SOURCE_KEY,
+									 DICTIONARY_DEFAULT_SOURCE_NAME);
 
 	context = get_context_from_loader (panel);
 	gtranslator_dict_panel_set_context (panel, context);
+	
+	if (priv->source_chooser)
+		gdict_source_chooser_set_current_source (GDICT_SOURCE_CHOOSER (priv->source_chooser),
+							 priv->source_name);
+}
+
+static void
+source_activated_cb (GdictSourceChooser *chooser,
+                     const gchar        *source_name,
+                     GdictSource        *source,
+                     GtranslatorDictPanel *panel)
+{
+	g_signal_handlers_block_by_func (chooser, source_activated_cb, panel);
+	gtranslator_dict_panel_set_source_name (panel, source_name);
+	g_signal_handlers_unblock_by_func (chooser, source_activated_cb, panel);
+	
+	if (panel->priv->status)
+	{
+		gchar *message;
+		
+		message = g_strdup_printf (_("Dictionary source '%s' selected"),
+					   gdict_source_get_description (source));
+		gtranslator_statusbar_flash_message (panel->priv->status, 0, message);
+		g_free (message);
+	}
 }
 
 static void
@@ -275,17 +300,17 @@
                        const gchar          *strat_desc,
                        GtranslatorDictPanel *panel)
 {
-/*	GtranslatorDictPanelPrivate *priv = panel->priv;
+	GtranslatorDictPanelPrivate *priv = panel->priv;
 	gtranslator_dict_panel_set_strategy (panel, strat_name);
 
-  if (window->status)
-    {
-      gchar *message;
-
-      message = g_strdup_printf (_("Strategy `%s' selected"), strat_desc);
-      gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, message);
-      g_free (message);
-    }*/
+	if (priv->status)
+	{
+		gchar *message;
+		
+		message = g_strdup_printf (_("Strategy '%s' selected"), strat_desc);
+		gtranslator_statusbar_flash_message (priv->status, 0, message);
+		g_free (message);
+	}
 }
 
 static void
@@ -294,17 +319,17 @@
 		       const gchar          *db_desc,
 		       GtranslatorDictPanel *panel)
 {
-/*	GtranslatorDictPanelPrivate *priv = panel->priv;
+	GtranslatorDictPanelPrivate *priv = panel->priv;
 	gtranslator_dict_panel_set_database (panel, db_name);
-
-  if (window->status)
-    {
-      gchar *message;
-
-      message = g_strdup_printf (_("Database `%s' selected"), db_desc);
-      gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, message);
-      g_free (message);
-    }*/
+	
+	if (priv->status)
+	{
+		gchar *message;
+		
+		message = g_strdup_printf (_("Database '%s' selected"), db_desc);
+		gtranslator_statusbar_flash_message (priv->status, 0, message);
+		g_free (message);
+	}
 }
 
 static void
@@ -342,19 +367,17 @@
 	gtk_entry_set_text (GTK_ENTRY (priv->entry), word);
 	
 	gtranslator_dict_panel_set_word (panel, word, db_name);
-	/*
-  if (window->status)
-    {
-      gchar *message;
-
-      message = g_strdup_printf (_("Word `%s' selected"), word);
-      gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, message);
-      g_free (message);
-    }*/
+	
+	if (priv->status)
+	{
+		gchar *message;
+		
+		message = g_strdup_printf (_("Word '%s' selected"), word);
+		gtranslator_statusbar_flash_message (priv->status, 0, message);
+		g_free (message);
+	}
 }
 
-
-
 static void
 sidebar_page_changed_cb (GdictSidebar *sidebar,
 			 GtranslatorDictPanel *panel)
@@ -364,7 +387,7 @@
 	const gchar *message;
 	
 	page_id = gdict_sidebar_current_page (sidebar);
-	
+
 	switch (page_id[0])
 	{
 		case 's':
@@ -382,6 +405,10 @@
 				
 					gdict_strategy_chooser_refresh (GDICT_STRATEGY_CHOOSER (priv->strat_chooser));
 				break;
+				case 'o': /* source-chooser */
+					message = _("Double-click on the source to use");
+					gdict_source_chooser_refresh (GDICT_SOURCE_CHOOSER (priv->source_chooser));
+				break;
 				default:
 					message = NULL;
 			}
@@ -397,24 +424,24 @@
 		break;
 	}
 	
-	/*if (message && window->status)
-	gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, message);*/
+	if (message && priv->status)
+		gtranslator_statusbar_flash_message (priv->status, 0, message);
 }
 
 static void
-store_position(GObject    *gobject,
-               GParamSpec *arg1,
-               gpointer    user_data)
+store_position (GObject    *gobject,
+		GParamSpec *arg1,
+		gpointer    user_data)
 {
-	GtkPaned *paned = GTK_PANED(gobject);
+	GtkPaned *paned = GTK_PANED (gobject);
 	GConfClient *client;
 	gint position;
 	
-	client = gconf_client_get_default();
-	position = gtk_paned_get_position(paned);
-	gconf_client_set_int(client, PANEL_KEY "/panel_position", position, NULL);
+	client = gconf_client_get_default ();
+	position = gtk_paned_get_position (paned);
+	gconf_client_set_int (client, DICTIONARY_GCONF_POSITION_KEY, position, NULL);
 	
-	g_object_unref(client);
+	g_object_unref (client);
 }
 
 static void
@@ -438,6 +465,7 @@
 {
 	GtkWidget  *vbox;
 	GtkWidget  *hbox;
+	gint position;
 	
 	vbox = gtk_vbox_new (FALSE, 6);
 	gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
@@ -485,6 +513,9 @@
 	gtk_container_add (GTK_CONTAINER (vbox), panel->priv->defbox);
 	gtk_widget_show (panel->priv->defbox);
 	
+	/*
+	 * Sidebar
+	 */
 	panel->priv->sidebar = gdict_sidebar_new ();
 	g_signal_connect (panel->priv->sidebar, "page-changed",
 			  G_CALLBACK (sidebar_page_changed_cb),
@@ -499,8 +530,12 @@
 	gtk_paned_pack2 (panel->priv->paned, panel->priv->sidebar, TRUE, TRUE);
 	gtk_widget_show (GTK_WIDGET(panel->priv->paned));
 	
-	g_signal_connect(panel->priv->paned, "notify::position",
-			 G_CALLBACK(store_position), NULL);
+	position = gconf_client_get_int (panel->priv->gconf_client,
+					 DICTIONARY_GCONF_POSITION_KEY, NULL);
+	gtk_paned_set_position (GTK_PANED (panel->priv->paned), position);
+	
+	g_signal_connect (panel->priv->paned, "notify::position",
+			  G_CALLBACK(store_position), NULL);
 	
 	
 	/*
@@ -551,10 +586,19 @@
 				_("Available strategies"),
 				panel->priv->strat_chooser);
 	gtk_widget_show (panel->priv->strat_chooser);
-
-	gtk_widget_show (panel->priv->sidebar);
 	
+	/* Source chooser */
+	panel->priv->source_chooser = gdict_source_chooser_new_with_loader (panel->priv->loader);
+	g_signal_connect (panel->priv->source_chooser, "source-activated",
+			  G_CALLBACK (source_activated_cb),
+			  panel);
+	gdict_sidebar_add_page (GDICT_SIDEBAR (panel->priv->sidebar),
+				GDICT_SIDEBAR_SOURCES_PAGE,
+				_("Dictionary sources"),
+				panel->priv->source_chooser);
+	gtk_widget_show (panel->priv->source_chooser);
 	
+	gtk_widget_show (panel->priv->sidebar);
 }
 
 static void
@@ -565,21 +609,21 @@
 {
 	GtranslatorDictPanel *panel = GTR_DICT_PANEL (user_data);
 
-	if (strcmp (entry->key, GDICT_GCONF_SOURCE_KEY) == 0)
+	if (strcmp (entry->key, DICTIONARY_GCONF_SOURCE_KEY) == 0)
 	{
 		if (entry->value && (entry->value->type == GCONF_VALUE_STRING))
 			gtranslator_dict_panel_set_source_name (panel, gconf_value_get_string (entry->value));
 		else
-			gtranslator_dict_panel_set_source_name (panel, GDICT_DEFAULT_SOURCE_NAME);
+			gtranslator_dict_panel_set_source_name (panel, DICTIONARY_DEFAULT_SOURCE_NAME);
 	}
-	else if (strcmp (entry->key, GDICT_GCONF_DATABASE_KEY) == 0)
+	else if (strcmp (entry->key, DICTIONARY_GCONF_DATABASE_KEY) == 0)
 	{
 		if (entry->value && (entry->value->type == GCONF_VALUE_STRING))
 			gtranslator_dict_panel_set_database (panel, gconf_value_get_string (entry->value));
 		else
 			gtranslator_dict_panel_set_database (panel, GDICT_DEFAULT_DATABASE);
 	}
-	else if (strcmp (entry->key, GDICT_GCONF_STRATEGY_KEY) == 0)
+	else if (strcmp (entry->key, DICTIONARY_GCONF_STRATEGY_KEY) == 0)
 	{
 		if (entry->value && (entry->value->type == GCONF_VALUE_STRING))
 			gtranslator_dict_panel_set_strategy (panel, gconf_value_get_string (entry->value));
@@ -598,23 +642,23 @@
 	panel->priv = GTR_DICT_PANEL_GET_PRIVATE (panel);
 	priv = panel->priv;
 	
+	priv->status = NULL;
+	
 	if (!priv->loader)
 		panel->priv->loader = gdict_source_loader_new ();
 	
 	/* add our data dir inside $HOME to the loader's search paths */
-	data_dir = gdict_get_data_dir ();
+	data_dir = gtranslator_utils_get_user_config_dir ();
 	gdict_source_loader_add_search_path (priv->loader, data_dir);
 	g_free (data_dir);
 	
-	
-	
 	/* get the default gconf client */
 	if (!priv->gconf_client)
 		priv->gconf_client = gconf_client_get_default ();
 
 	gconf_error = NULL;
 	gconf_client_add_dir (priv->gconf_client,
-			      GDICT_GCONF_DIR,
+			      DICTIONARY_GCONF_DIR,
 			      GCONF_CLIENT_PRELOAD_ONELEVEL,
 			      &gconf_error);
 	if (gconf_error)
@@ -626,7 +670,7 @@
 	}
 	
 	priv->notify_id = gconf_client_notify_add (priv->gconf_client,
-						   GDICT_GCONF_DIR,
+						   DICTIONARY_GCONF_DIR,
 						   gtranslator_dict_panel_gconf_notify_cb,
 						   panel, NULL,
 						   &gconf_error);
@@ -671,15 +715,12 @@
 }
 
 GtkWidget *
-gtranslator_dict_panel_new (void)
-{
-	return GTK_WIDGET (g_object_new (GTR_TYPE_DICT_PANEL, NULL));
-}
-
-void
-gtranslator_dict_panel_set_position(GtranslatorDictPanel *panel,
-			      gint pos)
+gtranslator_dict_panel_new (GtranslatorWindow *window)
 {
-	gtk_paned_set_position(panel->priv->paned, pos);
-}
-
+	GtranslatorDictPanel *panel;
+	
+	panel = g_object_new (GTR_TYPE_DICT_PANEL, NULL);
+	panel->priv->status = GTR_STATUSBAR (gtranslator_window_get_statusbar (window));
+	
+	return GTK_WIDGET (panel);
+}
\ No newline at end of file

Modified: trunk/plugins/dictionary/dict-panel.h
==============================================================================
--- trunk/plugins/dictionary/dict-panel.h	(original)
+++ trunk/plugins/dictionary/dict-panel.h	Mon Sep 22 09:41:25 2008
@@ -22,6 +22,8 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
+#include "window.h"
+
 G_BEGIN_DECLS
 
 /*
@@ -67,7 +69,7 @@
 
 GType		 gtranslator_dict_panel_register_type    (GTypeModule * module);
 
-GtkWidget *	 gtranslator_dict_panel_new 		   (void);
+GtkWidget *	 gtranslator_dict_panel_new 		   (GtranslatorWindow *window);
 
 void             gtranslator_dict_panel_set_position     (GtranslatorDictPanel *panel,
 						    gint pos);

Modified: trunk/plugins/dictionary/dict.gtranslator-plugin.desktop.in
==============================================================================
--- trunk/plugins/dictionary/dict.gtranslator-plugin.desktop.in	(original)
+++ trunk/plugins/dictionary/dict.gtranslator-plugin.desktop.in	Mon Sep 22 09:41:25 2008
@@ -3,7 +3,7 @@
 IAge=2
 _Name=Dictionary
 _Description=Look up words in a dictionary.
-Icon=gdict
+Icon=gnome-dictionary
 Authors=Ignacio Casal <nacho resa gmail com>
 Copyright=Copyright @ 2007 Ignacio Casal
 Website=http://gtranslator.sf.net

Modified: trunk/plugins/dictionary/dictionary-plugin.c
==============================================================================
--- trunk/plugins/dictionary/dictionary-plugin.c	(original)
+++ trunk/plugins/dictionary/dictionary-plugin.c	Mon Sep 22 09:41:25 2008
@@ -19,16 +19,14 @@
 #include <config.h>
 #endif
 
+#include "application.h"
 #include "dictionary-plugin.h"
 #include "dict-panel.h"
 #include "window.h"
 
 #include <glib/gi18n-lib.h>
-#include <gconf/gconf-client.h>
-//#include <gtranslator/gtranslator-debug.h>
 
 #define WINDOW_DATA_KEY	"GtranslatorDictPluginWindowData"
-#define PANEL_KEY "/apps/gtranslator/plugins/dictionary"
 
 #define GTR_DICT_PLUGIN_GET_PRIVATE(object) \
 				(G_TYPE_INSTANCE_GET_PRIVATE ((object),	\
@@ -42,20 +40,17 @@
 } WindowData;
 
 GTR_PLUGIN_REGISTER_TYPE_WITH_CODE (GtranslatorDictPlugin, gtranslator_dict_plugin,
-		gtranslator_dict_panel_register_type (module);
+				    gtranslator_dict_panel_register_type (module);
 )
 
 static void
 gtranslator_dict_plugin_init (GtranslatorDictPlugin *plugin)
 {
-	//gtranslator_debug_message (DEBUG_PLUGINS, "GtranslatorDictPlugin initializing");
 }
 
 static void
 gtranslator_dict_plugin_finalize (GObject *object)
 {
-	//gtranslator_debug_message (DEBUG_PLUGINS, "GtranslatorDictPlugin finalizing");
-
 	G_OBJECT_CLASS (gtranslator_dict_plugin_parent_class)->finalize (object);
 }
 
@@ -73,60 +68,33 @@
 {
 	GtkWidget      *panel;
 
-	panel = gtranslator_dict_panel_new ();
+	panel = gtranslator_dict_panel_new (window);
 
-	gtk_widget_show_all (panel);
+	gtk_widget_show (panel);
 
 	return panel;
 }
 
 static void
-restore_position(GtranslatorDictPanel *panel)
-{
-	GConfClient *client;
-	gint position;
-	
-	client = gconf_client_get_default();
-	position = gconf_client_get_int(client, PANEL_KEY "/panel_position", NULL);
-	gtranslator_dict_panel_set_position(panel, position);
-	
-	g_object_unref(client);
-}
-
-static void
 impl_activate (GtranslatorPlugin *plugin,
 	       GtranslatorWindow *window)
 {
-	/*GtkWidget *image;
-	GtkIconTheme *theme;*/
 	WindowData *data;
 
-	//gtranslator_debug (DEBUG_PLUGINS);
-
 	data = g_new (WindowData, 1);
-
-	/*theme = gtk_icon_theme_get_default ();
 	
-	if (gtk_icon_theme_has_icon (theme, "accessories-dictionary"))
-		image = gtk_image_new_from_icon_name ("accessories-dictionary",
-						      GTK_ICON_SIZE_MENU);
-	else
-		image = gtk_image_new_from_icon_name ("gdict",
-						      GTK_ICON_SIZE_MENU);*/
-
 	data->panel = create_dict_panel (window);
 	
-	restore_position(GTR_DICT_PANEL(data->panel));
+	gtranslator_application_register_icon (GTR_APP, "gnome-dictionary.png",
+					       "dictionary-icon");
 	
 	gtranslator_window_add_widget (window,
 				       data->panel,
 				       "GtranslatorDictionaryPlugin",
 				       _("Dictionary"),
-				       NULL,
+				       "dictionary-icon",
 				       GTR_WINDOW_PLACEMENT_LEFT);
 
-	//gtk_object_sink (GTK_OBJECT (image));
-
 	g_object_set_data_full (G_OBJECT (window),
 				WINDOW_DATA_KEY,
 				data,

Modified: trunk/plugins/dictionary/gdict-sidebar.c
==============================================================================
--- trunk/plugins/dictionary/gdict-sidebar.c	(original)
+++ trunk/plugins/dictionary/gdict-sidebar.c	Mon Sep 22 09:41:25 2008
@@ -58,7 +58,6 @@
   GtkWidget *hbox;
   GtkWidget *notebook;
   GtkWidget *menu;
-  GtkWidget *close_button;
   GtkWidget *label;
   GtkWidget *select_button;
 };
@@ -215,15 +214,6 @@
 }
 
 static void
-gdict_sidebar_close_clicked_cb (GtkWidget *widget,
-				gpointer   user_data)
-{
-  GdictSidebar *sidebar = GDICT_SIDEBAR (user_data);
-
-  g_signal_emit (sidebar, sidebar_signals[CLOSED], 0);
-}
-
-static void
 gdict_sidebar_menu_deactivate_cb (GtkWidget *widget,
 				  gpointer   user_data)
 {
@@ -309,7 +299,6 @@
   GtkWidget *hbox;
   GtkWidget *select_hbox;
   GtkWidget *select_button;
-  GtkWidget *close_button;
   GtkWidget *arrow;
 
   sidebar->priv = priv = GDICT_SIDEBAR_GET_PRIVATE (sidebar);
@@ -356,18 +345,6 @@
   gtk_box_pack_start (GTK_BOX (hbox), select_button, TRUE, TRUE, 0);
   gtk_widget_show (select_button);
 
-  close_button = gtk_button_new ();
-  gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
-  gtk_button_set_image (GTK_BUTTON (close_button),
-		        gtk_image_new_from_stock (GTK_STOCK_CLOSE,
-						  GTK_ICON_SIZE_SMALL_TOOLBAR));
-  g_signal_connect (close_button, "clicked",
-		    G_CALLBACK (gdict_sidebar_close_clicked_cb),
-		    sidebar);
-  gtk_box_pack_end (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
-  gtk_widget_show (close_button);
-  priv->close_button = close_button;
-
   sidebar->priv->menu = gtk_menu_new ();
   g_signal_connect (sidebar->priv->menu, "deactivate",
 		    G_CALLBACK (gdict_sidebar_menu_deactivate_cb),

Added: trunk/plugins/dictionary/gnome-dictionary.png
==============================================================================
Binary files (empty file) and trunk/plugins/dictionary/gnome-dictionary.png	Mon Sep 22 09:41:25 2008 differ



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