gtranslator r3558 - trunk/src
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gtranslator r3558 - trunk/src
- Date: Thu, 17 Apr 2008 12:01:48 +0100 (BST)
Author: icq
Date: Thu Apr 17 12:01:48 2008
New Revision: 3558
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3558&view=rev
Log:
2008-04-17 Ignacio Casal Quinteiro <nacho resa gmail com>
* po.ch:
* tab.ch:
* actions-file:
* window.c:
Changed GtranslatorTabState to GtranslatorPoState. It has
more sense.
Modified:
trunk/src/ChangeLog
trunk/src/actions-file.c
trunk/src/po.c
trunk/src/po.h
trunk/src/tab.c
trunk/src/tab.h
trunk/src/window.c
Modified: trunk/src/actions-file.c
==============================================================================
--- trunk/src/actions-file.c (original)
+++ trunk/src/actions-file.c Thu Apr 17 12:01:48 2008
@@ -226,7 +226,7 @@
}
/* We have to change the state of the tab */
- gtranslator_tab_set_state(tab, GTR_TAB_STATE_SAVED);
+ gtranslator_po_set_state(po, GTR_PO_STATE_SAVED);
g_free (filename);
}
@@ -386,7 +386,7 @@
}
/* We have to change the state of the tab */
- gtranslator_tab_set_state(current, GTR_TAB_STATE_SAVED);
+ gtranslator_po_set_state(po, GTR_PO_STATE_SAVED);
}
static gboolean
Modified: trunk/src/po.c
==============================================================================
--- trunk/src/po.c (original)
+++ trunk/src/po.c Thu Apr 17 12:01:48 2008
@@ -27,6 +27,7 @@
#include "file-dialogs.h"
#include "po.h"
#include "msg.h"
+#include "gtranslator-enum-types.h"
#include <string.h>
#include <errno.h>
@@ -111,10 +112,38 @@
* Header object
*/
GtranslatorHeader *header;
+
+ GtranslatorPoState state;
+};
+
+enum
+{
+ PROP_0,
+ PROP_STATE
};
static gchar *message_error = NULL;
+static void
+gtranslator_po_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtranslatorPo *po = GTR_PO (object);
+
+ switch (prop_id)
+ {
+ case PROP_STATE:
+ g_value_set_enum (value,
+ gtranslator_po_get_state (po));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
/*
* A helper function simply increments the "translated" variable of the
* po-file.
@@ -180,6 +209,16 @@
g_type_class_add_private (klass, sizeof (GtranslatorPoPrivate));
object_class->finalize = gtranslator_po_finalize;
+ object_class->get_property = gtranslator_po_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_STATE,
+ g_param_spec_enum ("state",
+ "State",
+ "The po's state",
+ GTR_TYPE_PO_STATE,
+ GTR_PO_STATE_SAVED,
+ G_PARAM_READABLE));
}
/*
@@ -478,6 +517,9 @@
priv->current = g_list_first(priv->messages);
gtranslator_po_update_translated_count(po);
+
+ /* Initialize Tab state*/
+ po->priv->state = GTR_PO_STATE_SAVED;
}
/**
@@ -637,7 +679,7 @@
*
* Return value: the file name string
**/
-gchar *
+const gchar *
gtranslator_po_get_filename(GtranslatorPo *po)
{
return po->priv->filename;
@@ -662,6 +704,34 @@
po->priv->filename = g_strdup(data);
}
+/**
+ * gtranslator_po_get_state:
+ * @po: a #GtranslatorPo
+ *
+ * Return value: the #GtranslatorPoState value of the @po.
+ */
+GtranslatorPoState
+gtranslator_po_get_state(GtranslatorPo *po)
+{
+ return po->priv->state;
+}
+
+/**
+ * gtranslator_po_set_state:
+ * @po: a #GtranslatorPo
+ * @state: a #GtranslatorPoState
+ *
+ * Sets the state for a #GtranslatorPo
+ */
+void
+gtranslator_po_set_state(GtranslatorPo *po,
+ GtranslatorPoState state)
+{
+ po->priv->state = state;
+
+ g_object_notify (G_OBJECT (po), "state");
+}
+
/*
* FIXME: We are not using this func.
*/
Modified: trunk/src/po.h
==============================================================================
--- trunk/src/po.h (original)
+++ trunk/src/po.h Thu Apr 17 12:01:48 2008
@@ -74,6 +74,12 @@
GTR_PO_ERROR_OTHER,
};
+typedef enum
+{
+ GTR_PO_STATE_SAVED,
+ GTR_PO_STATE_MODIFIED
+}GtranslatorPoState;
+
/*
* Public methods
*/
@@ -91,8 +97,13 @@
void gtranslator_po_save_file (GtranslatorPo *po,
GError **error);
+
+GtranslatorPoState gtranslator_po_get_state (GtranslatorPo *po);
+
+void gtranslator_po_set_state (GtranslatorPo *po,
+ GtranslatorPoState state);
-gchar *gtranslator_po_get_filename (GtranslatorPo *po);
+const gchar *gtranslator_po_get_filename (GtranslatorPo *po);
void gtranslator_po_set_filename (GtranslatorPo *po,
gchar *data);
Modified: trunk/src/tab.c
==============================================================================
--- trunk/src/tab.c (original)
+++ trunk/src/tab.c Thu Apr 17 12:01:48 2008
@@ -25,7 +25,6 @@
#endif
#include "comment.h"
-#include "gtranslator-enum-types.h"
#include "io-error-message-area.h"
#include "message-area.h"
#include "message-table.h"
@@ -53,8 +52,6 @@
{
GtranslatorPo *po;
- GtranslatorTabState state;
-
GtkWidget *table_pane;
GtkWidget *content_pane;
GtkWidget *panel;
@@ -88,35 +85,8 @@
LAST_SIGNAL
};
-enum
-{
- PROP_0,
- PROP_STATE
-};
-
static guint signals[LAST_SIGNAL];
-static void
-gtranslator_tab_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtranslatorTab *tab = GTR_TAB (object);
-
- switch (prop_id)
- {
- case PROP_STATE:
- g_value_set_enum (value,
- gtranslator_tab_get_state (tab));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
/*
* Write the change back to the gettext PO instance in memory and
* mark the page dirty
@@ -331,8 +301,10 @@
gpointer useless)
{
GtranslatorMsgStatus status;
+ GtranslatorPoState po_state;
- status = gtranslator_msg_get_status(msg);
+ status = gtranslator_msg_get_status (msg);
+ po_state = gtranslator_po_get_state (tab->priv->po);
if((status == GTR_MSG_STATUS_FUZZY) && !gtranslator_msg_is_fuzzy(msg))
{
@@ -371,11 +343,11 @@
}
}
- gtranslator_msg_set_status(msg, status);
+ gtranslator_msg_set_status (msg, status);
/* We need to update the tab state too if is neccessary*/
- if(tab->priv->state != GTR_TAB_STATE_MODIFIED)
- gtranslator_tab_set_state(tab, GTR_TAB_STATE_MODIFIED);
+ if (po_state != GTR_PO_STATE_MODIFIED)
+ gtranslator_po_set_state(tab->priv->po, GTR_PO_STATE_MODIFIED);
}
static void
@@ -560,9 +532,6 @@
G_CALLBACK(update_status), NULL);
gtranslator_tab_draw(tab);
-
- /* Initialize Tab state*/
- tab->priv->state = GTR_TAB_STATE_SAVED;
}
static void
@@ -585,16 +554,6 @@
g_type_class_add_private (klass, sizeof (GtranslatorTabPrivate));
object_class->finalize = gtranslator_tab_finalize;
- object_class->get_property = gtranslator_tab_get_property;
-
- g_object_class_install_property (object_class,
- PROP_STATE,
- g_param_spec_enum ("state",
- "State",
- "The tab's state",
- GTR_TYPE_TAB_STATE,
- GTR_TAB_STATE_SAVED,
- G_PARAM_READABLE));
signals[SHOWED_MESSAGE] =
g_signal_new("showed-message",
@@ -661,34 +620,6 @@
}
/**
- * gtranslator_tab_get_state:
- * @tab: a #GtranslatorTab
- *
- * Return value: the #GtranslatorTabState value of the @tab.
- */
-GtranslatorTabState
-gtranslator_tab_get_state(GtranslatorTab *tab)
-{
- return tab->priv->state;
-}
-
-/**
- * gtranslator_tab_set_state:
- * @tab: a #GtranslatorTab
- * @state: a #GtranslatorTabState
- *
- * Sets the state for a #GtranslatorTab
- */
-void
-gtranslator_tab_set_state(GtranslatorTab *tab,
- GtranslatorTabState state)
-{
- tab->priv->state = state;
-
- g_object_notify(G_OBJECT(tab), "state");
-}
-
-/**
* gtranslator_tab_get_panel:
* @tab: a #GtranslationTab
*
@@ -803,14 +734,16 @@
gtranslator_tab_get_name(GtranslatorTab *tab)
{
GtranslatorHeader *header;
+ GtranslatorPoState state;
gchar *str;
gchar *tab_name;
header = gtranslator_po_get_header(tab->priv->po);
+ state = gtranslator_po_get_state (tab->priv->po);
str = gtranslator_header_get_prj_id_version(header);
- if(tab->priv->state == GTR_TAB_STATE_MODIFIED)
+ if(state == GTR_PO_STATE_MODIFIED)
{
tab_name = g_strdup_printf("*%s", str);
return tab_name;
Modified: trunk/src/tab.h
==============================================================================
--- trunk/src/tab.h (original)
+++ trunk/src/tab.h Thu Apr 17 12:01:48 2008
@@ -71,12 +71,6 @@
GtranslatorMsg *msg);
};
-typedef enum
-{
- GTR_TAB_STATE_SAVED,
- GTR_TAB_STATE_MODIFIED
-}GtranslatorTabState;
-
/*
* Public methods
*/
@@ -88,11 +82,6 @@
GtranslatorPo *gtranslator_tab_get_po (GtranslatorTab *tab);
-GtranslatorTabState gtranslator_tab_get_state (GtranslatorTab *tab);
-
-void gtranslator_tab_set_state (GtranslatorTab *tab,
- GtranslatorTabState state);
-
GtkWidget *gtranslator_tab_get_panel (GtranslatorTab *tab);
gint gtranslator_tab_get_active_text_tab (GtranslatorTab *tab);
Modified: trunk/src/window.c
==============================================================================
--- trunk/src/window.c (original)
+++ trunk/src/window.c Thu Apr 17 12:01:48 2008
@@ -610,7 +610,7 @@
GtkSourceBuffer *buf;
GtkAction *action;
GList *current;
- GtranslatorTabState state;
+ GtranslatorPoState state;
view = gtranslator_tab_get_active_view(tab);
po = gtranslator_tab_get_po(tab);
@@ -621,11 +621,11 @@
gtk_action_group_set_sensitive(window->priv->action_group, TRUE);
/*File*/
- state = gtranslator_tab_get_state(tab);
+ state = gtranslator_po_get_state(po);
action = gtk_action_group_get_action (window->priv->action_group,
"FileSave");
gtk_action_set_sensitive (action,
- state == GTR_TAB_STATE_MODIFIED);
+ state == GTR_PO_STATE_MODIFIED);
/*Edit*/
action = gtk_action_group_get_action(window->priv->action_group,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]