plugins: don't leak memory

This commit is contained in:
Monsta 2014-11-22 19:11:28 +03:00 committed by infirit
parent d01f58c9f7
commit e5943056a8
2 changed files with 18 additions and 12 deletions

View File

@ -636,15 +636,17 @@ ignore_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d
static void
change_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
gchar *word;
const gchar *entry_text;
gchar *change;
gchar *word;
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (dlg->misspelled_word != NULL);
change = g_strdup (gtk_entry_get_text (GTK_ENTRY (dlg->word_entry)));
g_return_if_fail (change != NULL);
g_return_if_fail (*change != '\0');
entry_text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
g_return_if_fail (entry_text != NULL);
g_return_if_fail (*entry_text != '\0');
change = g_strdup (entry_text);
pluma_spell_checker_set_correction (dlg->spell_checker,
dlg->misspelled_word, -1,
@ -673,15 +675,17 @@ suggestions_list_row_activated_handler (GtkTreeView *view,
static void
change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
gchar *word;
const gchar *entry_text;
gchar *change;
gchar *word;
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (dlg->misspelled_word != NULL);
change = g_strdup (gtk_entry_get_text (GTK_ENTRY (dlg->word_entry)));
g_return_if_fail (change != NULL);
g_return_if_fail (*change != '\0');
entry_text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
g_return_if_fail (entry_text != NULL);
g_return_if_fail (*entry_text != '\0');
change = g_strdup (entry_text);
pluma_spell_checker_set_correction (dlg->spell_checker,
dlg->misspelled_word, -1,

View File

@ -712,9 +712,7 @@ get_configure_dialog (PlumaTimePlugin *plugin)
pluma_debug (DEBUG_PLUGINS);
dialog = g_new0 (TimeConfigureDialog, 1);
dialog->dialog = gtk_dialog_new_with_buttons (_("Configure insert date/time plugin..."),
GtkWidget *dlg = gtk_dialog_new_with_buttons (_("Configure insert date/time plugin..."),
NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL,
@ -725,6 +723,11 @@ get_configure_dialog (PlumaTimePlugin *plugin)
GTK_RESPONSE_HELP,
NULL);
g_return_val_if_fail (dlg != NULL, NULL);
dialog = g_new0 (TimeConfigureDialog, 1);
dialog->dialog = dlg;
/* HIG defaults */
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog))),
@ -733,7 +736,6 @@ get_configure_dialog (PlumaTimePlugin *plugin)
5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog->dialog))), 6);
g_return_val_if_fail (dialog->dialog != NULL, NULL);
data_dir = pluma_plugin_get_data_dir (PLUMA_PLUGIN (plugin));
ui_file = g_build_filename (data_dir, "pluma-time-setup-dialog.ui", NULL);