summaryrefslogtreecommitdiff
path: root/src/eggfileformatchooser.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-12-21 16:38:28 +0100
committerraveit65 <[email protected]>2021-01-07 18:37:10 +0100
commit98759f7bed3768ef150dcd41f97f87cbb84be8b1 (patch)
tree9d36f1a67229a67a117c1f9583dafbe9d1b55a8b /src/eggfileformatchooser.c
parentfacddb5353b18d19c8a5b4f62b11ac0f6e666724 (diff)
downloadengrampa-98759f7bed3768ef150dcd41f97f87cbb84be8b1.tar.bz2
engrampa-98759f7bed3768ef150dcd41f97f87cbb84be8b1.tar.xz
Remove cppcheck warnings about the variable scope can be reduced
Diffstat (limited to 'src/eggfileformatchooser.c')
-rw-r--r--src/eggfileformatchooser.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/eggfileformatchooser.c b/src/eggfileformatchooser.c
index 9161ea4..5addee3 100644
--- a/src/eggfileformatchooser.c
+++ b/src/eggfileformatchooser.c
@@ -99,11 +99,9 @@ egg_file_format_filter_info_new (const gchar *name,
static void
egg_file_format_filter_info_free (gpointer boxed)
{
- EggFileFormatFilterInfo *self;
-
if (boxed)
{
- self = boxed;
+ EggFileFormatFilterInfo *self = boxed;
g_hash_table_unref (self->extension_set);
g_slist_free_full (self->extension_list, g_free);
@@ -164,7 +162,6 @@ egg_file_format_filter_add_extensions (GtkFileFilter *filter,
GString *filter_name;
gchar **strings;
gchar **ptr;
- gchar *pattern;
g_assert (NULL != extensions);
@@ -185,7 +182,7 @@ egg_file_format_filter_add_extensions (GtkFileFilter *filter,
strings = g_strsplit (extensions, ", ", -1);
for (ptr = strings; *ptr; ptr++)
{
- pattern = g_strdup_printf ("*%s", *ptr);
+ gchar *pattern = g_strdup_printf ("*%s", *ptr);
if (filter_name)
{
@@ -211,7 +208,6 @@ static void
selection_changed_cb (GtkTreeSelection *selection,
EggFileFormatChooser *self)
{
- gchar *label;
gchar *name;
GtkFileFilter *filter;
@@ -221,6 +217,8 @@ selection_changed_cb (GtkTreeSelection *selection,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
+ gchar *label;
+
gtk_tree_model_get (model, &iter, MODEL_COLUMN_NAME, &name, -1);
label = g_strdup_printf (_("File _Format: %s"), name);
@@ -298,7 +296,6 @@ static gboolean
accept_filename (gchar *extensions,
const gchar *filename)
{
- const gchar *extptr;
gchar *saveptr;
gchar *token;
gsize length;
@@ -308,6 +305,8 @@ accept_filename (gchar *extensions,
for (token = strtok_r (extensions, ",", &saveptr); NULL != token;
token = strtok_r (NULL, ",", &saveptr))
{
+ const gchar *extptr;
+
token = g_strstrip (token);
extptr = filename + length - strlen (token) - 1;
@@ -636,14 +635,14 @@ chooser_response_cb (GtkDialog *dialog,
gpointer data)
{
EggFileFormatChooser *self;
- gchar *filename, *basename;
- gchar *message;
- guint format;
self = EGG_FILE_FORMAT_CHOOSER (data);
if (EGG_IS_POSITIVE_RESPONSE (response_id))
{
+ gchar *filename, *basename;
+ guint format;
+
filename = gtk_file_chooser_get_filename (self->priv->chooser);
basename = g_filename_display_basename (filename);
g_free (filename);
@@ -653,6 +652,7 @@ chooser_response_cb (GtkDialog *dialog,
if (0 == format)
{
+ gchar *message;
message = g_strdup_printf (
_("The program was not able to find out the file format "
@@ -892,7 +892,6 @@ get_icon_name (const gchar *mime_type)
{
static gboolean first_call = TRUE;
gchar *name = NULL;
- gchar *s;
if (first_call)
{
@@ -903,6 +902,8 @@ get_icon_name (const gchar *mime_type)
if (mime_type)
{
+ gchar *s;
+
name = g_strconcat ("mate-mime-", mime_type, NULL);
for(s = name; *s; ++s)