patch by Kjartan Maraas <kmaraas@gnome.org>, remove a load of leaks and

2005-02-08  Sebastien Bacher  <seb128@debian.org>

	* gnome-theme-installer.c: (file_theme_type), (transfer_done_cb),
	(install_dialog_response), (gnome_theme_installer_run):
	patch by Kjartan Maraas <kmaraas@gnome.org>, remove a load of leaks
	and make sure newly installed themes show up in the relevant lists
	without having to close/open the dialog again (Closes: #166267).

2005-02-08  Sebastien Bacher  <seb128@debian.org>

	* gnome-keyboard-properties-xkb.c: (setup_xkb_tabs):
	* gnome-keyboard-properties-xkblt.c: (def_group_in_gconf_changed):
	patch by Kjartan Maraas <kmaraas@gnome.org>, some code cleanups
	(Closes: #166267).

2005-02-08  Sebastien Bacher  <seb128@debian.org>

	* eggcellrendererkeys.c: (egg_cell_renderer_keys_start_editing):
	patch by Kjartan Maraas <kmaraas@gnome.org>, some code cleanups
        (Closes: #166267).

2005-02-08  Sebastien Bacher  <seb128@debian.org>

	* main.c: (wrap_in_label):
        patch by Kjartan Maraas <kmaraas@gnome.org>, some code cleanups
        (Closes: #166267).

2005-02-08  Sebastien Bacher  <seb128@debian.org>

	* gnome-theme-info.c: (update_common_theme_dir_index):
	* theme-thumbnail.c: (create_image):
	patch by Kjartan Maraas <kmaraas@gnome.org>, move to use GtkIconTheme
	and remove a load of leaks in the theme manager code (Closes: #166267).
This commit is contained in:
Sebastien Bacher 2005-02-08 22:42:10 +00:00 committed by Sebastien Bacher
parent b29dfe67f1
commit 12e01119d8
12 changed files with 134 additions and 34 deletions

View file

@ -1,3 +1,10 @@
2005-02-08 Sebastien Bacher <seb128@debian.org>
* gnome-theme-info.c: (update_common_theme_dir_index):
* theme-thumbnail.c: (create_image):
patch by Kjartan Maraas <kmaraas@gnome.org>, move to use GtkIconTheme
and remove a load of leaks in the theme manager code (Closes: #166267).
2005-02-03 Kjartan Maraas <kmaraas@gnome.org>
* gnome-theme-info.c: (update_theme_index),

View file

@ -687,7 +687,7 @@ update_common_theme_dir_index (GnomeVFSURI *theme_index_uri,
if (theme_exists)
{
g_hash_table_insert (hash_by_uri, g_strdup (common_theme_dir), theme_info);
add_data_to_hash_by_name (hash_by_name, g_strdup (name), theme_info);
add_data_to_hash_by_name (hash_by_name, name, theme_info);
handle_change_signal (icon_theme?GNOME_THEME_TYPE_ICON:GNOME_THEME_TYPE_METATHEME,
theme_info, GNOME_THEME_CHANGE_CREATED, 0);
}
@ -705,7 +705,7 @@ update_common_theme_dir_index (GnomeVFSURI *theme_index_uri,
if (cmp != 0)
{
g_hash_table_insert (hash_by_uri, g_strdup (common_theme_dir), theme_info);
add_data_to_hash_by_name (hash_by_name, g_strdup (name), theme_info);
add_data_to_hash_by_name (hash_by_name, name, theme_info);
handle_change_signal (icon_theme?GNOME_THEME_TYPE_ICON:GNOME_THEME_TYPE_METATHEME,
theme_info, GNOME_THEME_CHANGE_CHANGED, 0);
if (icon_theme)

View file

@ -117,19 +117,16 @@ create_image (ThemeThumbnailData *theme_thumbnail_data,
MetaFrameFlags flags;
MetaTheme *theme = NULL;
GtkSettings *settings;
GnomeIconTheme *icon_theme;
GtkIconTheme *icon_theme;
GdkPixbuf *folder_icon;
char *folder_icon_name;
char *foo;
GtkIconInfo *folder_icon_info;
const gchar *filename;
settings = gtk_settings_get_default ();
g_object_set (G_OBJECT (settings),
"gtk-theme-name", (char *) theme_thumbnail_data->control_theme_name->data,
"gtk-font-name", (char *) theme_thumbnail_data->application_font->data,
NULL);
g_object_get (G_OBJECT (settings),
"gtk-icon-sizes", &foo,
NULL);
theme = meta_theme_load ((char *) theme_thumbnail_data->wm_theme_name->data, NULL);
flags = META_FRAME_ALLOWS_DELETE |
@ -197,27 +194,30 @@ create_image (ThemeThumbnailData *theme_thumbnail_data,
gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, ICON_SIZE_WIDTH, ICON_SIZE_HEIGHT);
/* Handle the icon theme */
icon_theme = gnome_icon_theme_new ();
gnome_icon_theme_set_allow_svg (icon_theme, TRUE);
gnome_icon_theme_set_custom_theme (icon_theme, (char *) theme_thumbnail_data->icon_theme_name->data);
icon_theme = gtk_icon_theme_new ();
gtk_icon_theme_set_custom_theme (icon_theme, (char *) theme_thumbnail_data->icon_theme_name->data);
/* Have to try both "folder" and "gnome-fs-directory" seems themes seem to use either name */
folder_icon_name = gnome_icon_theme_lookup_icon (icon_theme, "folder", 48, NULL, NULL);
if (folder_icon_name == NULL) {
folder_icon_name = gnome_icon_theme_lookup_icon (icon_theme, "gnome-fs-directory", 48, NULL, NULL);
folder_icon_info = gtk_icon_theme_lookup_icon (icon_theme, "folder", 48, GTK_ICON_LOOKUP_FORCE_SVG);
if (folder_icon_info == NULL) {
folder_icon_info = gtk_icon_theme_lookup_icon (icon_theme, "gnome-fs-directory", 48, GTK_ICON_LOOKUP_FORCE_SVG);
}
g_object_unref (icon_theme);
filename = gtk_icon_info_get_filename (folder_icon_info);
if (folder_icon_name != NULL)
if (filename != NULL)
{
folder_icon = gdk_pixbuf_new_from_file (folder_icon_name, NULL);
g_free (folder_icon_name);
folder_icon = gdk_pixbuf_new_from_file (filename, NULL);
}
else
{
folder_icon = NULL;
}
gtk_icon_info_free (folder_icon_info);
/* render the icon to the thumbnail */
if (folder_icon)
{

View file

@ -1,3 +1,9 @@
2005-02-08 Sebastien Bacher <seb128@debian.org>
* main.c: (wrap_in_label):
patch by Kjartan Maraas <kmaraas@gnome.org>, some code cleanups
(Closes: #166267).
2004-11-09 Mark McLoughlin <mark@skynet.ie>
* Makefile.am: install .desktop file in $(datadir)/applications.

View file

@ -255,7 +255,7 @@ wrap_in_label (GtkWidget *child, char *text)
char *str;
vbox = gtk_vbox_new (FALSE, 6);
label = 0;
label = NULL;
label = gtk_label_new ("");

View file

@ -1,3 +1,9 @@
2005-02-08 Sebastien Bacher <seb128@debian.org>
* eggcellrendererkeys.c: (egg_cell_renderer_keys_start_editing):
patch by Kjartan Maraas <kmaraas@gnome.org>, some code cleanups
(Closes: #166267).
2005-01-13 Sebastien Bacher <seb128@debian.org>
* gnome-keybinding-properties.c: (start_editing_kb_cb),

View file

@ -574,7 +574,7 @@ egg_cell_renderer_keys_start_editing (GtkCellRenderer *cell,
if (gdk_pointer_grab (widget->window, FALSE,
GDK_BUTTON_PRESS_MASK,
FALSE, NULL,
NULL, NULL,
gdk_event_get_time (event)) != GDK_GRAB_SUCCESS)
{
gdk_keyboard_ungrab (gdk_event_get_time (event));

View file

@ -1,3 +1,10 @@
2005-02-08 Sebastien Bacher <seb128@debian.org>
* gnome-keyboard-properties-xkb.c: (setup_xkb_tabs):
* gnome-keyboard-properties-xkblt.c: (def_group_in_gconf_changed):
patch by Kjartan Maraas <kmaraas@gnome.org>, some code cleanups
(Closes: #166267).
2005-01-19 Sergey V. Udaltsov <svu@gnome.org>
* gnome-keyboard-properties-xkb.c,

View file

@ -137,8 +137,8 @@ chk_separate_group_per_window_toggled (GConfPropertyEditor *peditor,
void
setup_xkb_tabs (GladeXML * dialog, GConfChangeSet * changeset)
{
xkbGConfClient = gconf_client_get_default ();
GObject * peditor;
xkbGConfClient = gconf_client_get_default ();
XklInit (GDK_DISPLAY ());
XklConfigInit ();

View file

@ -105,11 +105,11 @@ def_group_in_gconf_changed (GConfClient * client,
if (value->type == GCONF_VALUE_INT)
{
defaultGroup = gconf_value_get_int (value);
GtkWidget* treeView = WID ("xkb_layouts_selected");
GtkTreeModel *model = GTK_TREE_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (treeView)));
GtkTreeIter iter;
int counter = 0;
defaultGroup = gconf_value_get_int (value);
if (gtk_tree_model_get_iter_first (model, &iter))
{
do

View file

@ -1,3 +1,11 @@
2005-02-08 Sebastien Bacher <seb128@debian.org>
* gnome-theme-installer.c: (file_theme_type), (transfer_done_cb),
(install_dialog_response), (gnome_theme_installer_run):
patch by Kjartan Maraas <kmaraas@gnome.org>, remove a load of leaks
and make sure newly installed themes show up in the relevant lists
without having to close/open the dialog again (Closes: #166267).
2005-02-07 Sebastien Bacher <seb128@debian.org>
* gnome-theme-installer.c: (transfer_done_cb): fix some strings,

View file

@ -4,6 +4,7 @@
#include <string.h>
#include <libwindow-settings/gnome-wm-manager.h>
#include "gnome-theme-installer.h"
#include "gnome-theme-details.h"
#include <gconf/gconf-client.h>
#include <glade/glade.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
@ -73,31 +74,43 @@ file_theme_type(gchar *dir)
pattern = g_pattern_spec_new ("*[Icon Theme]*");
if (g_pattern_match_string(pattern,file_contents)) {
g_free (filename);
gnome_vfs_uri_unref (src_uri);
return THEME_ICON;
}
pattern = g_pattern_spec_new ("*[X-GNOME-Metatheme]*");
if (g_pattern_match_string(pattern,file_contents)) {
g_free (filename);
gnome_vfs_uri_unref (src_uri);
return THEME_GNOME;
}
}
g_free (filename);
gnome_vfs_uri_unref (src_uri);
filename = g_strdup_printf ("%s/gtk-2.0/gtkrc",dir);
src_uri = gnome_vfs_uri_new (filename);
g_free (filename);
if (gnome_vfs_uri_exists(src_uri)) {
gnome_vfs_uri_unref (src_uri);
return THEME_GTK;
}
filename = g_strdup_printf ("%s/metacity-1/metacity-theme-1.xml",dir);
src_uri = gnome_vfs_uri_new (filename);
g_free (filename);
if (gnome_vfs_uri_exists (src_uri)) {
gnome_vfs_uri_unref (src_uri);
return THEME_METACITY;
}
filename = g_strdup_printf ("%s/configure.in",dir);
src_uri = gnome_vfs_uri_new (filename);
g_free (filename);
if (gnome_vfs_uri_exists (src_uri)) {
gnome_vfs_uri_unref (src_uri);
return THEME_ENGINE;
}
@ -215,6 +228,8 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gnome_vfs_unlink(path);
g_free (theme_props->target_tmp_dir);
g_free (theme_props);
return;
}
@ -229,6 +244,9 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
_("Failed to create temporary directory"));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (command);
g_free (theme_props->target_tmp_dir);
g_free (theme_props);
return;
}
@ -247,6 +265,10 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gnome_vfs_unlink(path);
g_free (command);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props);
return;
}
@ -260,7 +282,11 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
_("Installation Failed"));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
cleanup_tmp_dir (theme_props);
cleanup_tmp_dir (theme_props);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props);
g_free (command);
return;
}
}
@ -268,15 +294,19 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
if (theme_props->filetype == TARGZ ) {
if (!g_file_test ("/bin/gzip", G_FILE_TEST_EXISTS)) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
_("Can not install themes. \nThe gzip utility is not installed."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_widget_destroy (dialog);
gnome_vfs_unlink(path);
g_free (command);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props);
return;
}
if (!transfer_done_targz_idle_cb(theme_props)) {
@ -288,8 +318,12 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
GTK_BUTTONS_OK,
_("Installation Failed"));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
cleanup_tmp_dir (theme_props);
gtk_widget_destroy (dialog);
cleanup_tmp_dir (theme_props);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props);
g_free (command);
return;
}
}
@ -297,7 +331,7 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
/* What type of theme it is ? */
if (g_spawn_command_line_sync (command, &first_line, NULL, &status, NULL) && status == 0) {
dir = g_strsplit(g_strchomp(first_line),"/",0);
theme_props->theme_tmp_dir=g_strdup(g_build_filename(theme_props->target_tmp_dir,dir[0],NULL));
theme_props->theme_tmp_dir=g_build_filename(theme_props->target_tmp_dir,dir[0],NULL);
theme_type = file_theme_type(theme_props->theme_tmp_dir);
gnome_vfs_unlink (theme_props->filename);
@ -315,15 +349,20 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
theme_props->user_message=g_strdup_printf(_("Controls Theme %s correctly installed.\nYou can select it in the theme details."),dir[0]);
} else if (theme_type == THEME_ENGINE) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
_("The theme is an engine. You need to compile the theme."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
cleanup_tmp_dir(theme_props);
gtk_widget_destroy (dialog);
cleanup_tmp_dir(theme_props);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props->theme_tmp_dir);
g_free (theme_props);
g_free (command);
return;
} else {
GtkWidget *dialog;
@ -334,7 +373,12 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
GTK_BUTTONS_OK,
_("The file format is invalid"));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gtk_widget_destroy (dialog);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props->theme_tmp_dir);
g_free (theme_props);
g_free (command);
return;
}
/* Move the Dir to the target dir */
@ -356,6 +400,13 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
cleanup_tmp_dir(theme_props);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props->theme_tmp_dir);
g_free (theme_props->target_dir);
g_free (theme_props->user_message);
g_free (theme_props);
g_free (command);
return;
} else {
GtkWidget *dialog;
@ -368,11 +419,21 @@ transfer_done_cb (GtkWidget *dlg, gchar *path)
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
cleanup_tmp_dir (theme_props);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props->theme_tmp_dir);
g_free (theme_props->target_dir);
g_free (theme_props->user_message);
g_free (theme_props);
g_free (command);
return;
}
}
g_free(theme_props);
g_free (command);
g_free (theme_props->target_tmp_dir);
g_free (theme_props->filename);
g_free (theme_props);
}
static void
@ -444,11 +505,13 @@ install_dialog_response (GtkWidget *widget, int response_id, gpointer data)
_("Insufficient permissions to install the theme in:\n%s"), path);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
g_free (path);
return;
}
while(TRUE) {
gchar *file_tmp;
GtkWidget *dialog;
int len = strlen (base);
if (base && len > 7 && ( (!strcmp (base + len - 7, ".tar.gz")) || (!strcmp (base + len - 4, ".tgz")) ))
@ -463,7 +526,7 @@ install_dialog_response (GtkWidget *widget, int response_id, gpointer data)
_("The file format is invalid."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
gnome_vfs_unlink(path);
g_free (path);
return;
}
@ -494,6 +557,7 @@ install_dialog_response (GtkWidget *widget, int response_id, gpointer data)
g_free (base);
g_free (filename);
g_free(temppath);
g_free (path);
return;
}
g_free(temppath);
@ -558,6 +622,8 @@ gnome_theme_installer_run (GtkWidget *parent, gchar *filename)
while (gtk_dialog_run (GTK_DIALOG (widget)) == GTK_RESPONSE_HELP)
;
gnome_theme_details_reread_themes_from_disk();
gtk_widget_destroy (widget);
g_object_unref (G_OBJECT (dialog));