Commit 33b70e00 authored by Daniel García Moreno's avatar Daniel García Moreno

Remove all deprecated code

parent 036800a0
Pipeline #30412 passed with stage
in 15 minutes and 57 seconds
......@@ -72,20 +72,6 @@
If true, display whitespace in strings as representative symbols.
</description>
</key>
<key name="use-custom-font" type="b">
<default>false</default>
<summary>Use custom font</summary>
<description>
If true, use a custom font for edit fields.
</description>
</key>
<key name="editor-font" type="s">
<default>'Sans 10'</default>
<summary>Editor font</summary>
<description>
Custom font to use for edit fields.
</description>
</key>
<key name="unmark-fuzzy-when-changed" type="b">
<default>true</default>
<summary>Remove fuzzy status when message is changed</summary>
......
......@@ -59,8 +59,6 @@ gtr_open (GFile * location, GtrWindow * window, GError ** error)
GtrTab *tab;
GList *current;
GtrView *active_view;
GtrHeader *header;
const gchar *project_id;
/*
* If the filename can't be opened, pass the error back to the caller
......@@ -80,9 +78,6 @@ gtr_open (GFile * location, GtrWindow * window, GError ** error)
return FALSE;
}
header = gtr_po_get_header (po);
project_id = gtr_header_get_prj_id_version (header);
/*
* Create a page to add to our list of open files
*/
......
......@@ -135,9 +135,6 @@ gtr_close_confirmation_dialog_init (GtrCloseConfirmationDialog * dlg)
{
AtkObject *atk_obj;
GtrCloseConfirmationDialogPrivate *priv;
priv = gtr_close_confirmation_dialog_get_instance_private (dlg);
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), 14);
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
......
......@@ -34,14 +34,7 @@
#include "gtr-settings.h"
#include "gtr-po.h"
#define GTR_HEADER_DIALOG_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ( \
(object), \
GTR_TYPE_HEADER_DIALOG, \
GtrHeaderDialogPrivate))
G_DEFINE_TYPE (GtrHeaderDialog, gtr_header_dialog, GTK_TYPE_DIALOG)
struct _GtrHeaderDialogPrivate
typedef struct
{
GSettings *settings;
......@@ -67,14 +60,22 @@ struct _GtrHeaderDialogPrivate
GtkWidget *encoding;
GtrPo *po;
} GtrHeaderDialogPrivate;
struct _GtrHeaderDialog
{
GtkDialog parent_instance;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtrHeaderDialog, gtr_header_dialog, GTK_TYPE_DIALOG)
static void
gtr_header_dialog_dispose (GObject * object)
{
GtrHeaderDialog *dlg = GTR_HEADER_DIALOG (object);
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
g_clear_object (&dlg->priv->settings);
g_clear_object (&priv->settings);
G_OBJECT_CLASS (gtr_header_dialog_parent_class)->dispose (object);
}
......@@ -84,8 +85,6 @@ gtr_header_dialog_class_init (GtrHeaderDialogClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GtrHeaderDialogPrivate));
object_class->dispose = gtr_header_dialog_dispose;
}
......@@ -94,19 +93,20 @@ take_my_options_checkbutton_toggled (GtkToggleButton * button,
GtrHeaderDialog * dlg)
{
gboolean active;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->take_my_options));
g_return_if_fail (button == GTK_TOGGLE_BUTTON (priv->take_my_options));
active = gtk_toggle_button_get_active (button);
g_settings_set_boolean (dlg->priv->settings, GTR_SETTINGS_USE_PROFILE_VALUES,
g_settings_set_boolean (priv->settings, GTR_SETTINGS_USE_PROFILE_VALUES,
active);
gtk_widget_set_sensitive (dlg->priv->translator, !active);
gtk_widget_set_sensitive (dlg->priv->tr_email, !active);
gtk_widget_set_sensitive (dlg->priv->language, !active);
gtk_widget_set_sensitive (dlg->priv->lg_email, !active);
gtk_widget_set_sensitive (dlg->priv->encoding, !active);
gtk_widget_set_sensitive (priv->translator, !active);
gtk_widget_set_sensitive (priv->tr_email, !active);
gtk_widget_set_sensitive (priv->language, !active);
gtk_widget_set_sensitive (priv->lg_email, !active);
gtk_widget_set_sensitive (priv->encoding, !active);
}
static void
......@@ -121,15 +121,16 @@ prj_comment_changed (GtkTextBuffer * buffer, GtrHeaderDialog * dlg)
{
GtkTextIter start, end;
gchar *text;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
gtk_text_buffer_get_bounds (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
if (text)
{
gtr_header_set_comments (gtr_po_get_header (dlg->priv->po), text);
gtr_header_set_comments (gtr_po_get_header (priv->po), text);
g_free (text);
po_state_set_modified (dlg->priv->po);
po_state_set_modified (priv->po);
}
}
......@@ -137,13 +138,14 @@ static void
prj_id_version_changed (GtkWidget * widget, GtrHeaderDialog * dlg)
{
const gchar *text;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
text = gtk_entry_get_text (GTK_ENTRY (widget));
if (text)
{
gtr_header_set_prj_id_version (gtr_po_get_header (dlg->priv->po), text);
po_state_set_modified (dlg->priv->po);
gtr_header_set_prj_id_version (gtr_po_get_header (priv->po), text);
po_state_set_modified (priv->po);
}
}
......@@ -151,13 +153,14 @@ static void
rmbt_changed (GtkWidget * widget, GtrHeaderDialog * dlg)
{
const gchar *text;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
text = gtk_entry_get_text (GTK_ENTRY (widget));
if (text)
{
gtr_header_set_rmbt (gtr_po_get_header (dlg->priv->po), text);
po_state_set_modified (dlg->priv->po);
gtr_header_set_rmbt (gtr_po_get_header (priv->po), text);
po_state_set_modified (priv->po);
}
}
......@@ -165,14 +168,15 @@ static void
translator_changed (GtkWidget * widget, GtrHeaderDialog * dlg)
{
const gchar *name, *email;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
name = gtk_entry_get_text (GTK_ENTRY (dlg->priv->translator));
email = gtk_entry_get_text (GTK_ENTRY (dlg->priv->tr_email));
name = gtk_entry_get_text (GTK_ENTRY (priv->translator));
email = gtk_entry_get_text (GTK_ENTRY (priv->tr_email));
if (name && email)
{
gtr_header_set_translator (gtr_po_get_header (dlg->priv->po), name, email);
po_state_set_modified (dlg->priv->po);
gtr_header_set_translator (gtr_po_get_header (priv->po), name, email);
po_state_set_modified (priv->po);
}
}
......@@ -180,14 +184,15 @@ static void
language_changed (GtkWidget * widget, GtrHeaderDialog * dlg)
{
const gchar *language, *lg_email;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
language = gtk_entry_get_text (GTK_ENTRY (dlg->priv->language));
lg_email = gtk_entry_get_text (GTK_ENTRY (dlg->priv->lg_email));
language = gtk_entry_get_text (GTK_ENTRY (priv->language));
lg_email = gtk_entry_get_text (GTK_ENTRY (priv->lg_email));
if (language && lg_email)
{
gtr_header_set_language (gtr_po_get_header (dlg->priv->po), language, lg_email);
po_state_set_modified (dlg->priv->po);
gtr_header_set_language (gtr_po_get_header (priv->po), language, lg_email);
po_state_set_modified (priv->po);
}
}
......@@ -197,60 +202,60 @@ gtr_header_dialog_fill_from_header (GtrHeaderDialog * dlg)
GtrHeader *header;
GtkTextBuffer *buffer;
gchar *text;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
header = gtr_po_get_header (dlg->priv->po);
header = gtr_po_get_header (priv->po);
/* Project Information */
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dlg->priv->prj_comment));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->prj_comment));
gtk_text_buffer_set_text (buffer, gtr_header_get_comments (header), -1);
text = gtr_header_get_prj_id_version (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->prj_id_version), text);
gtk_entry_set_text (GTK_ENTRY (priv->prj_id_version), text);
g_free (text);
text = gtr_header_get_pot_date (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->pot_date), text);
gtk_entry_set_text (GTK_ENTRY (priv->pot_date), text);
g_free (text);
text = gtr_header_get_po_date (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->po_date), text);
gtk_entry_set_text (GTK_ENTRY (priv->po_date), text);
g_free (text);
text = gtr_header_get_rmbt (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->rmbt), text);
gtk_entry_set_text (GTK_ENTRY (priv->rmbt), text);
g_free (text);
/* Translator and Language Information */
text = gtr_header_get_translator (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->translator), text);
gtk_entry_set_text (GTK_ENTRY (priv->translator), text);
g_free (text);
text = gtr_header_get_tr_email (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->tr_email), text);
gtk_entry_set_text (GTK_ENTRY (priv->tr_email), text);
g_free (text);
text = gtr_header_get_language (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->language), text);
gtk_entry_set_text (GTK_ENTRY (priv->language), text);
g_free (text);
text = gtr_header_get_lg_email (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->lg_email), text);
gtk_entry_set_text (GTK_ENTRY (priv->lg_email), text);
g_free (text);
text = gtr_header_get_charset (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->charset), text);
gtk_entry_set_text (GTK_ENTRY (priv->charset), text);
g_free (text);
text = gtr_header_get_encoding (header);
gtk_entry_set_text (GTK_ENTRY (dlg->priv->encoding), text);
gtk_entry_set_text (GTK_ENTRY (priv->encoding), text);
g_free (text);
}
static void
gtr_header_dialog_init (GtrHeaderDialog * dlg)
{
GtrHeaderDialogPrivate *priv;
GtkWidget *action_area;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
GtkBox *content_area;
GtkBuilder *builder;
gchar *root_objects[] = {
......@@ -258,25 +263,19 @@ gtr_header_dialog_init (GtrHeaderDialog * dlg)
NULL
};
dlg->priv = GTR_HEADER_DIALOG_GET_PRIVATE (dlg);
priv = dlg->priv;
dlg->priv->settings = g_settings_new ("org.gnome.gtranslator.preferences.files");
priv->settings = g_settings_new ("org.gnome.gtranslator.preferences.files");
gtk_dialog_add_buttons (GTK_DIALOG (dlg),
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
_("_Close"), GTK_RESPONSE_CLOSE, NULL);
gtk_window_set_title (GTK_WINDOW (dlg), _("Edit Header"));
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dlg));
content_area = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg)));
gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
gtk_box_set_spacing (content_area, 2);
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
gtk_box_set_spacing (GTK_BOX (action_area), 4);
g_signal_connect (dlg, "response", G_CALLBACK (gtk_widget_destroy), NULL);
......@@ -286,50 +285,50 @@ gtr_header_dialog_init (GtrHeaderDialog * dlg)
priv->main_box = GTK_WIDGET (gtk_builder_get_object (builder, "main_box"));
g_object_ref (priv->main_box);
dlg->priv->notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
dlg->priv->lang_vbox = GTK_WIDGET (gtk_builder_get_object (builder, "lang_vbox"));
dlg->priv->prj_id_version = GTK_WIDGET (gtk_builder_get_object (builder, "prj_id_version"));
dlg->priv->rmbt = GTK_WIDGET (gtk_builder_get_object (builder, "rmbt"));
dlg->priv->prj_comment = GTK_WIDGET (gtk_builder_get_object (builder, "prj_comment"));
dlg->priv->take_my_options = GTK_WIDGET (gtk_builder_get_object (builder, "take_my_options"));
dlg->priv->translator = GTK_WIDGET (gtk_builder_get_object (builder, "tr_name"));
dlg->priv->tr_email = GTK_WIDGET (gtk_builder_get_object (builder, "tr_email"));
dlg->priv->pot_date = GTK_WIDGET (gtk_builder_get_object (builder, "pot_date"));
dlg->priv->po_date = GTK_WIDGET (gtk_builder_get_object (builder, "po_date"));
dlg->priv->language = GTK_WIDGET (gtk_builder_get_object (builder, "language_entry"));
dlg->priv->lg_email = GTK_WIDGET (gtk_builder_get_object (builder, "lg_email_entry"));
dlg->priv->charset = GTK_WIDGET (gtk_builder_get_object (builder, "charset_entry"));
dlg->priv->encoding = GTK_WIDGET (gtk_builder_get_object (builder, "encoding_entry"));
priv->notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
priv->lang_vbox = GTK_WIDGET (gtk_builder_get_object (builder, "lang_vbox"));
priv->prj_id_version = GTK_WIDGET (gtk_builder_get_object (builder, "prj_id_version"));
priv->rmbt = GTK_WIDGET (gtk_builder_get_object (builder, "rmbt"));
priv->prj_comment = GTK_WIDGET (gtk_builder_get_object (builder, "prj_comment"));
priv->take_my_options = GTK_WIDGET (gtk_builder_get_object (builder, "take_my_options"));
priv->translator = GTK_WIDGET (gtk_builder_get_object (builder, "tr_name"));
priv->tr_email = GTK_WIDGET (gtk_builder_get_object (builder, "tr_email"));
priv->pot_date = GTK_WIDGET (gtk_builder_get_object (builder, "pot_date"));
priv->po_date = GTK_WIDGET (gtk_builder_get_object (builder, "po_date"));
priv->language = GTK_WIDGET (gtk_builder_get_object (builder, "language_entry"));
priv->lg_email = GTK_WIDGET (gtk_builder_get_object (builder, "lg_email_entry"));
priv->charset = GTK_WIDGET (gtk_builder_get_object (builder, "charset_entry"));
priv->encoding = GTK_WIDGET (gtk_builder_get_object (builder, "encoding_entry"));
g_object_unref (builder);
gtk_box_pack_start (content_area, dlg->priv->main_box, FALSE, FALSE, 0);
gtk_box_pack_start (content_area, priv->main_box, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (dlg->priv->notebook), 5);
gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), 5);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->take_my_options),
g_settings_get_boolean (dlg->priv->settings,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->take_my_options),
g_settings_get_boolean (priv->settings,
GTR_SETTINGS_USE_PROFILE_VALUES));
gtk_text_view_set_editable (GTK_TEXT_VIEW (dlg->priv->prj_comment), TRUE);
gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->prj_comment), TRUE);
gtk_widget_set_sensitive (dlg->priv->pot_date, FALSE);
gtk_widget_set_sensitive (dlg->priv->po_date, FALSE);
gtk_widget_set_sensitive (dlg->priv->charset, FALSE);
gtk_widget_set_sensitive (priv->pot_date, FALSE);
gtk_widget_set_sensitive (priv->po_date, FALSE);
gtk_widget_set_sensitive (priv->charset, FALSE);
if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (dlg->priv->take_my_options)))
(GTK_TOGGLE_BUTTON (priv->take_my_options)))
{
gboolean active;
active =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(dlg->priv->take_my_options));
(priv->take_my_options));
gtk_widget_set_sensitive (dlg->priv->translator, !active);
gtk_widget_set_sensitive (dlg->priv->tr_email, !active);
gtk_widget_set_sensitive (dlg->priv->language, !active);
gtk_widget_set_sensitive (dlg->priv->lg_email, !active);
gtk_widget_set_sensitive (dlg->priv->encoding, !active);
gtk_widget_set_sensitive (priv->translator, !active);
gtk_widget_set_sensitive (priv->tr_email, !active);
gtk_widget_set_sensitive (priv->language, !active);
gtk_widget_set_sensitive (priv->lg_email, !active);
gtk_widget_set_sensitive (priv->encoding, !active);
}
}
......@@ -338,38 +337,39 @@ set_default_values (GtrHeaderDialog * dlg, GtrWindow * window)
{
GtkTextBuffer *buffer;
GtrTab *tab;
GtrHeaderDialogPrivate *priv = gtr_header_dialog_get_instance_private (dlg);
/* Write header's values on Header dialog */
tab = gtr_window_get_active_tab (window);
dlg->priv->po = gtr_tab_get_po (tab);
priv->po = gtr_tab_get_po (tab);
gtr_header_dialog_fill_from_header (GTR_HEADER_DIALOG (dlg));
/*Connect signals */
g_signal_connect (dlg->priv->take_my_options, "toggled",
g_signal_connect (priv->take_my_options, "toggled",
G_CALLBACK (take_my_options_checkbutton_toggled), dlg);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dlg->priv->prj_comment));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->prj_comment));
g_signal_connect (buffer, "changed", G_CALLBACK (prj_comment_changed), dlg);
/* Connect signals to edit Project information on Header dialog */
g_signal_connect (dlg->priv->prj_id_version, "changed",
g_signal_connect (priv->prj_id_version, "changed",
G_CALLBACK (prj_id_version_changed), dlg);
g_signal_connect (dlg->priv->rmbt, "changed",
g_signal_connect (priv->rmbt, "changed",
G_CALLBACK (rmbt_changed), dlg);
/* Connect signals to edit Translator and Language information on Header dialog */
g_signal_connect (dlg->priv->translator, "changed",
g_signal_connect (priv->translator, "changed",
G_CALLBACK (translator_changed), dlg);
g_signal_connect (dlg->priv->tr_email, "changed",
g_signal_connect (priv->tr_email, "changed",
G_CALLBACK (translator_changed), dlg);
g_signal_connect (dlg->priv->language, "changed",
g_signal_connect (priv->language, "changed",
G_CALLBACK (language_changed), dlg);
g_signal_connect (dlg->priv->lg_email, "changed",
g_signal_connect (priv->lg_email, "changed",
G_CALLBACK (language_changed), dlg);
}
......
......@@ -36,22 +36,11 @@
#define GTR_IS_HEADER_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_HEADER_DIALOG))
#define GTR_HEADER_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_HEADER_DIALOG, GtrHeaderDialogClass))
/* Private structure type */
typedef struct _GtrHeaderDialogPrivate GtrHeaderDialogPrivate;
/*
* Main object structure
*/
typedef struct _GtrHeaderDialog GtrHeaderDialog;
struct _GtrHeaderDialog
{
GtkDialog parent_instance;
/*< private > */
GtrHeaderDialogPrivate *priv;
};
/*
* Class definition
*/
......
......@@ -36,22 +36,22 @@
#include <glib-object.h>
#include <string.h>
#define GTR_HEADER_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ( \
(object), \
GTR_TYPE_HEADER, \
GtrHeaderPrivate))
G_DEFINE_TYPE (GtrHeader, gtr_header, GTR_TYPE_MSG)
struct _GtrHeaderPrivate
typedef struct
{
GSettings *settings;
GtrProfileManager *prof_manager;
GtrProfile *profile;
gint nplurals;
} GtrHeaderPrivate;
struct _GtrHeader
{
GtrMsg parent_instance;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtrHeader, gtr_header, GTR_TYPE_MSG)
static void
gtr_header_set_field (GtrHeader * header,
const gchar * field, const gchar * data)
......@@ -74,10 +74,11 @@ parse_nplurals (GtrHeader * header)
{
gchar *pointer, *plural_forms;
gboolean use_profile_values;
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
plural_forms = gtr_header_get_plural_forms (header);
header->priv->nplurals = -1;
use_profile_values = g_settings_get_boolean (header->priv->settings,
priv->nplurals = -1;
use_profile_values = g_settings_get_boolean (priv->settings,
GTR_SETTINGS_USE_PROFILE_VALUES);
if (use_profile_values || !plural_forms)
......@@ -85,8 +86,8 @@ parse_nplurals (GtrHeader * header)
const gchar *plural_form = NULL;
GtrProfile *profile;
if (header->priv->profile != NULL)
profile = header->priv->profile;
if (priv->profile != NULL)
profile = priv->profile;
else
{
GtrProfileManager *prof_manager;
......@@ -129,10 +130,10 @@ parse_nplurals (GtrHeader * header)
else
return;
header->priv->nplurals = g_ascii_digit_value (*pointer);
priv->nplurals = g_ascii_digit_value (*pointer);
}
/*g_message ("nplurals: %d", header->priv->nplurals); */
/*g_message ("nplurals: %d", priv->nplurals); */
g_free (plural_forms);
}
......@@ -142,22 +143,23 @@ profile_removed_cb (GtrProfileManager *prof_manager,
GtrProfile *profile,
GtrHeader *header)
{
if (profile == header->priv->profile)
header->priv->profile = NULL;
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
if (profile == priv->profile)
priv->profile = NULL;
}
static void
gtr_header_init (GtrHeader * header)
{
header->priv = GTR_HEADER_GET_PRIVATE (header);
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
header->priv->nplurals = -1;
header->priv->profile = NULL;
priv->nplurals = -1;
priv->profile = NULL;
header->priv->settings = g_settings_new ("org.gnome.gtranslator.preferences.files");
header->priv->prof_manager = gtr_profile_manager_get_default ();
priv->settings = g_settings_new ("org.gnome.gtranslator.preferences.files");
priv->prof_manager = gtr_profile_manager_get_default ();
g_signal_connect (header->priv->prof_manager, "profile-removed",
g_signal_connect (priv->prof_manager, "profile-removed",
G_CALLBACK (profile_removed_cb), header);
}
......@@ -165,10 +167,11 @@ static void
gtr_header_dispose (GObject * object)
{
GtrHeader *header = GTR_HEADER (object);
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
g_clear_object (&header->priv->settings);
g_clear_object (&header->priv->prof_manager);
g_clear_object (&header->priv->profile);
g_clear_object (&priv->settings);
g_clear_object (&priv->prof_manager);
g_clear_object (&priv->profile);
G_OBJECT_CLASS (gtr_header_parent_class)->dispose (object);
}
......@@ -178,8 +181,6 @@ gtr_header_class_init (GtrHeaderClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GtrHeaderPrivate));
object_class->dispose = gtr_header_dispose;
}
......@@ -536,10 +537,11 @@ gtr_header_set_plural_forms (GtrHeader * header, const gchar * plural_forms)
gint
gtr_header_get_nplurals (GtrHeader * header)
{
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
g_return_val_if_fail (GTR_IS_HEADER (header), 1);
if (header->priv->nplurals > -1)
return header->priv->nplurals;
if (priv->nplurals > -1)
return priv->nplurals;
else
return 1;
}
......@@ -549,13 +551,14 @@ set_profile_values (GtrHeader *header)
{
GtrProfile *active_profile;
gboolean use_profile_values;
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
if (header->priv->profile != NULL)
active_profile = header->priv->profile;
if (priv->profile != NULL)
active_profile = priv->profile;
else
active_profile = gtr_profile_manager_get_active_profile (header->priv->prof_manager);
active_profile = gtr_profile_manager_get_active_profile (priv->prof_manager);
use_profile_values = g_settings_get_boolean (header->priv->settings,
use_profile_values = g_settings_get_boolean (priv->settings,
GTR_SETTINGS_USE_PROFILE_VALUES);
if (use_profile_values && active_profile != NULL)
......@@ -608,15 +611,16 @@ update_comments (GtrHeader *header, const gchar *comments)
gchar *current_year;
gboolean use_profile_values;
gint i;
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
if (header->priv->profile != NULL)
active_profile = header->priv->profile;
if (priv->profile != NULL)
active_profile = priv->profile;
else
active_profile = gtr_profile_manager_get_active_profile (header->priv->prof_manager);
active_profile = gtr_profile_manager_get_active_profile (priv->prof_manager);
current_year = gtr_utils_get_current_year ();
use_profile_values = g_settings_get_boolean (header->priv->settings,
use_profile_values = g_settings_get_boolean (priv->settings,
GTR_SETTINGS_USE_PROFILE_VALUES);
/* Save the previous translator to update the header's comment */
......@@ -732,9 +736,10 @@ void
gtr_header_set_profile (GtrHeader *header,
GtrProfile *profile)
{
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
g_return_if_fail (GTR_IS_HEADER (header));
header->priv->profile = g_object_ref (profile);
priv->profile = g_object_ref (profile);
}
/**
......@@ -748,7 +753,8 @@ gtr_header_set_profile (GtrHeader *header,
GtrProfile *
gtr_header_get_profile (GtrHeader *header)
{
GtrHeaderPrivate *priv = gtr_header_get_instance_private (header);
g_return_val_if_fail (GTR_IS_HEADER (header), NULL);
return header->priv->profile;
return priv->profile;
}
......@@ -40,20 +40,9 @@ G_BEGIN_DECLS
#define GTR_IS_HEADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTR_TYPE_HEADER))
#define GTR_HEADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTR_TYPE_HEADER, GtrHeaderClass))
/* Private structure type */
typedef struct _GtrHeaderPrivate GtrHeaderPrivate;
/* Main object structure */
typedef struct _GtrHeader GtrHeader;
struct _GtrHeader
{
GtrMsg parent_instance;
/*< private > */
GtrHeaderPrivate *priv;
};
/* Class definition */
typedef struct _GtrHeaderClass GtrHeaderClass;
......
......@@ -49,11 +49,7 @@ enum
#define GTR_HISTORY_ENTRY_HISTORY_LENGTH_DEFAULT 10
#define GTR_HISTORY_ENTRY_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
GTR_TYPE_HISTORY_ENTRY, \
GtrHistoryEntryPrivate))
struct _GtrHistoryEntryPrivate
typedef struct
{
gchar *history_id;
guint history_length;
......@@ -61,16 +57,23 @@ struct _GtrHistoryEntryPrivate
GtkEntryCompletion *completion;
GSettings *settings;
} GtrHistoryEntryPrivate;
struct _GtrHistoryEntry
{
GtkComboBoxText parent_instance;
};
G_DEFINE_TYPE (GtrHistoryEntry, gtr_history_entry, GTK_TYPE_COMBO_BOX_TEXT)
static void
gtr_history_entry_set_property (GObject * object,