don't delete ~/.icons when deleting the last icon theme (bug #543763)
2008-07-20 Jens Granseuer <jensgr@gmx.net> * theme-util.c: (theme_delete): don't delete ~/.icons when deleting the last icon theme (bug #543763) svn path=/trunk/; revision=8791
This commit is contained in:
parent
8e7530a1cf
commit
dfb3ffda0c
2 changed files with 17 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-07-20 Jens Granseuer <jensgr@gmx.net>
|
||||||
|
|
||||||
|
* theme-util.c: (theme_delete): don't delete ~/.icons when deleting
|
||||||
|
the last icon theme (bug #543763)
|
||||||
|
|
||||||
2008-07-15 Matthias Clasen <mclasen@redhat.com>
|
2008-07-15 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
Bug 533611 - add notification themes to the metatheme format
|
Bug 533611 - add notification themes to the metatheme format
|
||||||
|
|
|
@ -126,6 +126,7 @@ theme_delete (const gchar *name, ThemeType type)
|
||||||
gint response;
|
gint response;
|
||||||
GnomeThemeCommonInfo *theme;
|
GnomeThemeCommonInfo *theme;
|
||||||
GFile *dir;
|
GFile *dir;
|
||||||
|
gboolean del_empty_parent;
|
||||||
|
|
||||||
dialog = (GtkDialog *) gtk_message_dialog_new (NULL,
|
dialog = (GtkDialog *) gtk_message_dialog_new (NULL,
|
||||||
GTK_DIALOG_MODAL,
|
GTK_DIALOG_MODAL,
|
||||||
|
@ -138,6 +139,10 @@ theme_delete (const gchar *name, ThemeType type)
|
||||||
if (response == GTK_RESPONSE_CANCEL)
|
if (response == GTK_RESPONSE_CANCEL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
/* Most theme types are put into separate subdirectories. For those
|
||||||
|
we want to delete those directories as well. */
|
||||||
|
del_empty_parent = TRUE;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case THEME_TYPE_GTK:
|
case THEME_TYPE_GTK:
|
||||||
theme = (GnomeThemeCommonInfo *) gnome_theme_info_find (name);
|
theme = (GnomeThemeCommonInfo *) gnome_theme_info_find (name);
|
||||||
|
@ -147,6 +152,7 @@ theme_delete (const gchar *name, ThemeType type)
|
||||||
case THEME_TYPE_ICON:
|
case THEME_TYPE_ICON:
|
||||||
theme = (GnomeThemeCommonInfo *) gnome_theme_icon_info_find (name);
|
theme = (GnomeThemeCommonInfo *) gnome_theme_icon_info_find (name);
|
||||||
theme_dir = g_path_get_dirname (theme->path);
|
theme_dir = g_path_get_dirname (theme->path);
|
||||||
|
del_empty_parent = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case THEME_TYPE_WINDOW:
|
case THEME_TYPE_WINDOW:
|
||||||
|
@ -181,10 +187,12 @@ theme_delete (const gchar *name, ThemeType type)
|
||||||
gtk_widget_destroy (info_dialog);
|
gtk_widget_destroy (info_dialog);
|
||||||
rc = FALSE;
|
rc = FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* also delete empty parent directories */
|
if (del_empty_parent) {
|
||||||
GFile *parent = g_file_get_parent (dir);
|
/* also delete empty parent directories */
|
||||||
g_file_delete (parent, NULL, NULL);
|
GFile *parent = g_file_get_parent (dir);
|
||||||
g_object_unref (parent);
|
g_file_delete (parent, NULL, NULL);
|
||||||
|
g_object_unref (parent);
|
||||||
|
}
|
||||||
rc = TRUE;
|
rc = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue