Initial GNOME2 port. ui-preferences is disabled until it is revamped for

2001-12-02  Richard Hestilow  <hestilow@ximian.com>

	* Initial GNOME2 port. ui-preferences is disabled until
	it is revamped for gconf, and mime-types will probably be
	permanently disabled though (no gmc).
This commit is contained in:
Richard Hestilow 2001-12-02 21:31:22 +00:00 committed by Rachel Hestilow
parent 4d7fc6d7c0
commit 41b2652989
21 changed files with 170 additions and 337 deletions

View file

@ -36,7 +36,7 @@ capplets_DATA = $(desktop_files)
EXTRA_DIST = $(desktop_in_files) Sawfish.directory.in.in $(pixmaps_DATA)
$(desktop_files): %.desktop: %.desktop.in
$(top_builddir)/xml-i18n-merge -d $(top_srcdir)/po $< $@
$(top_builddir)/intltool-merge -d $(top_srcdir)/po $< $@
## Create the .directory file
@ -58,7 +58,7 @@ $(groups_in_files): %.directory.in: %.directory.in.in
sed s#Icon=\.*#Icon=$(GNOMECC_ICONS_DIR)/${group_icon}# < $< > $@
$(groups_files): %.directory: %.directory.in
$(top_builddir)/xml-i18n-merge -d $(top_srcdir)/po $< $@
$(top_builddir)/intltool-merge -d $(top_srcdir)/po $< $@
## We need to install this ourselves cause we change the name of the
## file to .directory.

View file

@ -19,7 +19,7 @@ pixmap_DATA =
##
## You should not need to modify anything below this line
##
@XML_I18N_MERGE_DESKTOP_RULE@
@INTLTOOL_DESKTOP_RULE@
@GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) $(VFS_CAPPLET_CFLAGS)

View file

@ -241,7 +241,7 @@ static gboolean
component_is_in_list (const char *search_name, GList *component_list)
{
GList *list_element;
OAF_ServerInfo *info;
Bonobo_ServerInfo *info;
gchar *component_name;
if (component_list == NULL || search_name == NULL) {
@ -299,7 +299,7 @@ populate_default_components_box (GtkWidget *box, const char *mime_type)
{
GList *short_component_list;
GList *all_component_list, *list_element;
OAF_ServerInfo *info;
Bonobo_ServerInfo *info;
gchar *component_name;
GtkWidget *button;
@ -613,7 +613,7 @@ str_has_prefix (const char *haystack, const char *needle)
}
char *
name_from_oaf_server_info (OAF_ServerInfo *server)
name_from_oaf_server_info (Bonobo_ServerInfo *server)
{
const char *view_as_name;
char *display_name;
@ -622,10 +622,10 @@ name_from_oaf_server_info (OAF_ServerInfo *server)
display_name = NULL;
langs = get_lang_list ();
view_as_name = oaf_server_info_prop_lookup (server, "nautilus:view_as_name", langs);
view_as_name = bonobo_server_info_prop_lookup (server, "nautilus:view_as_name", langs);
if (view_as_name == NULL) {
view_as_name = oaf_server_info_prop_lookup (server, "name", langs);
view_as_name = bonobo_server_info_prop_lookup (server, "name", langs);
}
if (view_as_name == NULL) {

View file

@ -27,7 +27,7 @@
void show_edit_applications_dialog (const char *mime_type);
void show_edit_components_dialog (const char *mime_type);
char *name_from_oaf_server_info (OAF_ServerInfo *server);
char *name_from_oaf_server_info (Bonobo_ServerInfo *server);
char *nautilus_mime_type_capplet_show_new_mime_window (void);
char *nautilus_mime_type_capplet_show_new_extension_window (void);
char *nautilus_mime_type_capplet_show_change_extension_window (const char *mime_type,

View file

@ -82,8 +82,6 @@ static void gtk_widget_make_bold (GtkWidget *widget);
static GdkFont *gdk_font_get_bold (const GdkFont *plain_font);
static void gtk_widget_set_font (GtkWidget *widget,
GdkFont *font);
static void gtk_style_set_font (GtkStyle *style,
GdkFont *font);
static GdkPixbuf *capplet_gdk_pixbuf_scale_to_fit (GdkPixbuf *pixbuf,
int max_width,
int max_height);
@ -192,22 +190,6 @@ main (int argc, char **argv)
gnome_vfs_init ();
#ifdef MATHIEU_DEBUG
nautilus_make_warnings_and_criticals_stop_in_debugger (G_LOG_DOMAIN, g_log_domain_glib,
"Bonobo",
"Gdk",
"GnomeUI",
"GnomeVFS",
"GnomeVFS-CORBA",
"GnomeVFS-pthread",
"Gtk",
"Nautilus",
"Nautilus-Authenticate",
"Nautilus-Tree",
"ORBit",
NULL);
#endif /* MATHIEU_DEBUG */
if (init_results == 0) {
init_mime_capplet (mime_type);
capplet_gtk_main ();
@ -457,7 +439,7 @@ change_icon_clicked (GtkWidget *entry, gpointer user_data)
gtk_signal_connect (GTK_OBJECT (dialog), "clicked", change_icon_clicked_cb_real, user_data);
gis = gtk_object_get_user_data(GTK_OBJECT(user_data));
gtk_signal_connect_after (GTK_OBJECT(GNOME_ICON_SELECTION(gis)->gil),
gtk_signal_connect_after (GTK_OBJECT(gnome_icon_selection_get_gil(GNOME_ICON_SELECTION(gis))),
"select_icon", icon_chosen_callback, user_data);
}
@ -1164,8 +1146,8 @@ populate_viewer_menu (GtkWidget *component_menu, const char *mime_type)
{
GtkWidget *new_menu, *menu_item;
GList *component_list, *copy_list;
OAF_ServerInfo *default_component;
OAF_ServerInfo *info;
Bonobo_ServerInfo *default_component;
Bonobo_ServerInfo *info;
gboolean has_none, found_match;
char *mime_copy, *component_name;
const char *iid;
@ -1362,7 +1344,7 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
GdkBitmap *bitmap;
GnomeVFSMimeAction *action;
GnomeVFSMimeApplication *default_app;
OAF_ServerInfo *default_component;
Bonobo_ServerInfo *default_component;
int found_index;
mime_string = nautilus_mime_type_capplet_show_new_mime_window ();
@ -1419,7 +1401,7 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
filename = capplet_get_icon_path (DEFAULT_ACTION_ICON);
if (filename != NULL) {
pixbuf = gdk_pixbuf_new_from_file (filename);
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
g_free (filename);
}
@ -1435,7 +1417,7 @@ add_mime_clicked (GtkWidget *widget, gpointer data)
g_free (tmp_text);
filename = capplet_get_icon_path ("nautilus/gnome-library.png");
if (filename != NULL) {
pixbuf = gdk_pixbuf_new_from_file (filename);
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
g_free (filename);
}
CORBA_free (default_component);
@ -1583,7 +1565,7 @@ update_mime_list_action (const char *mime_string)
GdkBitmap *bitmap;
GnomeVFSMimeAction *action;
GnomeVFSMimeApplication *default_app;
OAF_ServerInfo *default_component;
Bonobo_ServerInfo *default_component;
char *text, *tmp_text, *icon_path;
int row;
@ -1606,7 +1588,7 @@ update_mime_list_action (const char *mime_string)
text = g_strdup (default_app->name);
icon_path = capplet_get_icon_path (DEFAULT_ACTION_ICON);
if (icon_path != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon_path);
pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
g_free (icon_path);
}
gnome_vfs_mime_application_free (default_app);
@ -1621,7 +1603,7 @@ update_mime_list_action (const char *mime_string)
g_free (tmp_text);
icon_path = capplet_get_icon_path ("nautilus/gnome-library.png");
if (icon_path != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon_path);
pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
g_free (icon_path);
}
CORBA_free (default_component);
@ -1668,7 +1650,7 @@ capplet_get_icon_pixbuf (const char *mime_string, gboolean is_executable)
icon_path = capplet_get_icon_path (icon_name);
if (icon_path != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon_path);
pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
g_free (icon_path);
}
@ -1689,7 +1671,7 @@ populate_mime_list (GList *type_list, GtkCList *clist)
GdkBitmap *bitmap;
GnomeVFSMimeAction *action;
GnomeVFSMimeApplication *default_app;
OAF_ServerInfo *default_component;
Bonobo_ServerInfo *default_component;
for (element = type_list; element != NULL; element= element->next) {
mime_string = (char *)element->data;
@ -1749,7 +1731,7 @@ populate_mime_list (GList *type_list, GtkCList *clist)
icon_path = capplet_get_icon_path (DEFAULT_ACTION_ICON);
if (icon_path != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon_path);
pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
g_free (icon_path);
}
gnome_vfs_mime_application_free (default_app);
@ -1764,7 +1746,7 @@ populate_mime_list (GList *type_list, GtkCList *clist)
g_free (tmp_text);
icon_path = capplet_get_icon_path ("nautilus/gnome-library.png");
if (icon_path != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon_path);
pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
g_free (icon_path);
}
CORBA_free (default_component);
@ -1866,8 +1848,8 @@ mime_list_reset_row_height (GtkCList *list)
guint height_for_text;
height_for_icon = MAX_ICON_HEIGHT_IN_LIST + 1;
height_for_text = GTK_WIDGET (list)->style->font->ascent +
GTK_WIDGET (list)->style->font->descent + 1;
height_for_text = gtk_style_get_font (GTK_WIDGET (list)->style)->ascent +
gtk_style_get_font (GTK_WIDGET (list)->style)->descent + 1;
gtk_clist_set_row_height (list, MAX (height_for_icon, height_for_text));
}
@ -1963,7 +1945,7 @@ gtk_widget_make_bold (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (widget));
style = gtk_widget_get_style (widget);
bold_font = gdk_font_get_bold (style->font);
bold_font = gdk_font_get_bold (gtk_style_get_font (style));
if (bold_font == NULL) {
return;
@ -1996,24 +1978,6 @@ gtk_widget_set_font (GtkWidget *widget, GdkFont *font)
gtk_style_unref (new_style);
}
/**
* gtk_style_set_font
*
* Sets the font in a style object, managing the ref. counts.
* @style: The style to change.
* @font: The new font.
**/
static void
gtk_style_set_font (GtkStyle *style, GdkFont *font)
{
g_return_if_fail (style != NULL);
g_return_if_fail (font != NULL);
gdk_font_ref (font);
gdk_font_unref (style->font);
style->font = font;
}
/**
* gdk_font_get_bold
* @plain_font: A font.
@ -2024,63 +1988,7 @@ gtk_style_set_font (GtkStyle *style, GdkFont *font)
static GdkFont *
gdk_font_get_bold (const GdkFont *plain_font)
{
const char *plain_name;
const char *scanner;
char *bold_name;
int count;
GSList *p;
GdkFont *result;
GdkFontPrivate *private_plain;
private_plain = (GdkFontPrivate *)plain_font;
if (private_plain->names == NULL) {
return NULL;
}
/* -foundry-family-weight-slant-sel_width-add-style-pixels-points-hor_res-ver_res-spacing-average_width-char_set_registry-char_set_encoding */
bold_name = NULL;
for (p = private_plain->names; p != NULL; p = p->next) {
plain_name = (const char *)p->data;
scanner = plain_name;
/* skip past foundry and family to weight */
for (count = 2; count > 0; count--) {
scanner = strchr (scanner + 1, '-');
if (!scanner) {
break;
}
}
if (!scanner) {
/* try the other names in the list */
continue;
}
g_assert (*scanner == '-');
/* copy "-foundry-family-" over */
scanner++;
bold_name = g_strndup (plain_name, scanner - plain_name);
/* skip weight */
scanner = strchr (scanner, '-');
g_assert (scanner != NULL);
/* add "bold" and copy everything past weight over */
bold_name = g_strconcat (bold_name, "bold", scanner, NULL);
break;
}
if (bold_name == NULL) {
return NULL;
}
result = gdk_font_load (bold_name);
g_free (bold_name);
return result;
return gdk_font_ref (plain_font);
}

View file

@ -53,8 +53,8 @@ nautilus_mime_type_icon_entry_get_type (void)
sizeof (GnomeIconEntryClass),
(GtkClassInitFunc) nautilus_mime_type_icon_entry_class_init,
(GtkObjectInitFunc) nautilus_mime_type_icon_entry_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL
NULL,
NULL
};
icon_entry_type = gtk_type_unique (gtk_vbox_get_type (),
@ -74,7 +74,6 @@ static void
entry_changed(GtkWidget *widget, NautilusMimeIconEntry *ientry)
{
gchar *t;
GdkImlibImage *im;
GtkWidget *child;
int w,h;
@ -86,37 +85,14 @@ entry_changed(GtkWidget *widget, NautilusMimeIconEntry *ientry)
child = GTK_BIN(ientry->frame)->child;
if (!t || !g_file_test (t, G_FILE_TEST_ISLINK|G_FILE_TEST_ISFILE) ||
!(im = gdk_imlib_load_image (t))) {
if (GNOME_IS_PIXMAP (child)) {
gtk_drag_source_unset (ientry->frame);
gtk_widget_destroy (child);
}
g_free(t);
return;
}
g_free(t);
w = im->rgb_width;
h = im->rgb_height;
if(w>h) {
if(w>48) {
h = h*(48.0/w);
w = 48;
}
} else {
if(h>48) {
w = w*(48.0/h);
h = 48;
}
}
if(GNOME_IS_PIXMAP (child)) {
gnome_pixmap_load_imlib_at_size (GNOME_PIXMAP(child),im, w, h);
gnome_pixmap_load_file (GNOME_PIXMAP(child), t);
} else {
if (child != NULL) {
gtk_widget_destroy (child);
}
child = gnome_pixmap_new_from_imlib_at_size (im, w, h);
child = gnome_pixmap_new_from_file (t);
gtk_widget_show (child);
gtk_container_add (GTK_CONTAINER(ientry->frame), child);
@ -127,7 +103,6 @@ entry_changed(GtkWidget *widget, NautilusMimeIconEntry *ientry)
GDK_ACTION_COPY);
}
}
gdk_imlib_destroy_image(im);
/*gtk_drag_source_set (ientry->frame,
GDK_BUTTON1_MASK|GDK_BUTTON3_MASK,
@ -159,7 +134,7 @@ entry_activated(GtkWidget *widget, NautilusMimeIconEntry *ientry)
gis = gtk_object_get_user_data(GTK_OBJECT(ientry));
gnome_icon_selection_clear (gis, TRUE);
gnome_icon_selection_add_directory (gis, filename);
if (gis->file_list)
/* if (gis->file_list) */
gnome_icon_selection_show_icons(gis);
} else {
/* FIXME: This is a hack to act exactly like we've clicked the
@ -176,7 +151,6 @@ setup_preview(GtkWidget *widget)
gchar *p;
GList *l;
GtkWidget *pp = NULL;
GdkImlibImage *im;
int w,h;
GtkWidget *frame;
GtkFileSelection *fs;
@ -196,28 +170,12 @@ setup_preview(GtkWidget *widget)
gtk_widget_destroy(pp);
p = gtk_file_selection_get_filename(fs);
if(!p || !g_file_test (p,G_FILE_TEST_ISLINK|G_FILE_TEST_ISFILE) ||
!(im = gdk_imlib_load_image (p)))
if(!p || !g_file_test (p,G_FILE_TEST_IS_SYMLINK|G_FILE_TEST_IS_REGULAR))
return;
w = im->rgb_width;
h = im->rgb_height;
if(w>h) {
if(w>100) {
h = h*(100.0/w);
w = 100;
}
} else {
if(h>100) {
w = w*(100.0/h);
h = 100;
}
}
pp = gnome_pixmap_new_from_imlib_at_size (im, w, h);
pp = gnome_pixmap_new_from_file (p);
gtk_widget_show(pp);
gtk_container_add(GTK_CONTAINER(frame),pp);
gdk_imlib_destroy_image(im);
}
static void
@ -322,12 +280,12 @@ nautilus_mime_type_show_icon_selection (NautilusMimeIconEntry *icon_entry)
}
/* figure out the directory */
if (!g_file_test (p, G_FILE_TEST_ISDIR)) {
if (!g_file_test (p, G_FILE_TEST_IS_DIR)) {
gchar *d;
d = g_dirname (p);
g_free (p);
p = d;
if (!g_file_test (p, G_FILE_TEST_ISDIR)) {
if (!g_file_test (p, G_FILE_TEST_IS_DIR)) {
g_free (p);
if (fe->default_path) {
p = g_strdup (fe->default_path);
@ -339,7 +297,7 @@ nautilus_mime_type_show_icon_selection (NautilusMimeIconEntry *icon_entry)
}
gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (icon_entry->fentry))),
p);
g_return_if_fail (g_file_test (p,G_FILE_TEST_ISDIR));
g_return_if_fail (g_file_test (p,G_FILE_TEST_IS_DIR));
}
}
@ -358,7 +316,7 @@ nautilus_mime_type_show_icon_selection (NautilusMimeIconEntry *icon_entry)
icon_entry->pick_dialog_dir = p;
icon_entry->pick_dialog =
gnome_dialog_new(GNOME_FILE_ENTRY(icon_entry->fentry)->browse_dialog_title,
gnome_dialog_new("",
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
@ -392,7 +350,7 @@ nautilus_mime_type_show_icon_selection (NautilusMimeIconEntry *icon_entry)
if(curfile)
gnome_icon_selection_select_icon(GNOME_ICON_SELECTION(iconsel),
g_filename_pointer(curfile));
g_basename(curfile));
/* FIXME:
* OK button is handled by caller, Cancel button is handled here.
@ -519,7 +477,7 @@ nautilus_mime_type_icon_entry_new (const gchar *history_id, const gchar *browse_
gentry = gnome_file_entry_gnome_entry(GNOME_FILE_ENTRY(ientry->fentry));
gnome_entry_set_history_id (GNOME_ENTRY (gentry), history_id);
gnome_entry_load_history (GNOME_ENTRY (gentry));
/* gnome_entry_load_history (GNOME_ENTRY (gentry)); */
gnome_file_entry_set_title (GNOME_FILE_ENTRY(ientry->fentry),
browse_dialog_title);

View file

@ -15,7 +15,7 @@ pixmap_DATA =
##
## You should not need to modify anything below this line
##
@XML_I18N_MERGE_DESKTOP_RULE@
@INTLTOOL_DESKTOP_RULE@
@GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)

View file

@ -19,7 +19,7 @@ pixmap_DATA =
##
## You should not need to modify anything below this line
##
@XML_I18N_MERGE_DESKTOP_RULE@
@INTLTOOL_DESKTOP_RULE@
@GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)

View file

@ -1,5 +1,4 @@
#include <gnome.h>
#include <gtk-xmhtml/gtk-xmhtml.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <sys/types.h>

View file

@ -1,5 +1,4 @@
#include <gnome.h>
#include <gtk-xmhtml/gtk-xmhtml.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <sys/types.h>

View file

@ -126,6 +126,7 @@ install_theme_callback (GtkWidget *widget, gpointer data)
/* We'd like to set a transient_for hint here, but it isn't
* worth the bother, since our parent window isn't in this process
*/
#if 0
if ( gnome_preferences_get_dialog_centered() ) {
/* User wants us to center over parent */
@ -149,6 +150,7 @@ install_theme_callback (GtkWidget *widget, gpointer data)
dialog_x, dialog_y);
}
}
#endif
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (install_theme_file_sel)
->ok_button), "clicked",
(GtkSignalFunc) browse_dialog_ok,
@ -258,7 +260,7 @@ make_main(void)
/* for now we just assume default gtk font */
initial_font = g_strdup(_("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*"));
} else {
initial_font = style->rc_style->font_name;
initial_font = pango_font_description_to_string (style->rc_style->font_desc);
}
}
@ -356,22 +358,7 @@ click_preview(GtkWidget *widget, gpointer data)
static void
click_help(GtkWidget *widget, gpointer data)
{
gchar *tmp;
tmp = gnome_help_file_find_file ("users-guide", "gccdesktop.html#GCCTHEME");
if (tmp) {
gnome_help_goto(0, tmp);
g_free(tmp);
} else {
GtkWidget *mbox;
mbox = gnome_message_box_new(_("No help is available/installed for these settings. Please make sure you\nhave the GNOME User's Guide installed on your system."),
GNOME_MESSAGE_BOX_ERROR,
_("Close"), NULL);
gtk_widget_show(mbox);
}
gnome_help_display_with_doc_id (gnome_program_get (), "users-guide", "gccdesktop.html", "#GCCTHEME", NULL);
}
static void
click_try(GtkWidget *widget, gpointer data)
@ -402,11 +389,11 @@ click_try(GtkWidget *widget, gpointer data)
{
use_theme(rc, NULL);
}
gdk_error_warnings = 0;
gdk_error_trap_push ();
signal_apply_theme(widget);
gdk_flush();
/* system(cmd); */
gdk_error_warnings = 1;
gdk_error_trap_pop ();
}
static void
click_ok(GtkWidget *widget, gpointer data)
@ -444,10 +431,10 @@ click_revert(GtkWidget *widget, gpointer data)
* or if the theme has been set.. */
send_reread();
use_theme(rc, initial_font);
gdk_error_warnings = 0;
gdk_error_trap_push ();
signal_apply_theme(widget);
gdk_flush();
gdk_error_warnings = 1;
gdk_error_trap_pop ();
}
current_global_theme = initial_theme;
ignore_change = TRUE;

View file

@ -126,6 +126,7 @@ install_theme_callback (GtkWidget *widget, gpointer data)
/* We'd like to set a transient_for hint here, but it isn't
* worth the bother, since our parent window isn't in this process
*/
#if 0
if ( gnome_preferences_get_dialog_centered() ) {
/* User wants us to center over parent */
@ -149,6 +150,7 @@ install_theme_callback (GtkWidget *widget, gpointer data)
dialog_x, dialog_y);
}
}
#endif
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (install_theme_file_sel)
->ok_button), "clicked",
(GtkSignalFunc) browse_dialog_ok,
@ -258,7 +260,7 @@ make_main(void)
/* for now we just assume default gtk font */
initial_font = g_strdup(_("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*"));
} else {
initial_font = style->rc_style->font_name;
initial_font = pango_font_description_to_string (style->rc_style->font_desc);
}
}
@ -356,22 +358,7 @@ click_preview(GtkWidget *widget, gpointer data)
static void
click_help(GtkWidget *widget, gpointer data)
{
gchar *tmp;
tmp = gnome_help_file_find_file ("users-guide", "gccdesktop.html#GCCTHEME");
if (tmp) {
gnome_help_goto(0, tmp);
g_free(tmp);
} else {
GtkWidget *mbox;
mbox = gnome_message_box_new(_("No help is available/installed for these settings. Please make sure you\nhave the GNOME User's Guide installed on your system."),
GNOME_MESSAGE_BOX_ERROR,
_("Close"), NULL);
gtk_widget_show(mbox);
}
gnome_help_display_with_doc_id (gnome_program_get (), "users-guide", "gccdesktop.html", "#GCCTHEME", NULL);
}
static void
click_try(GtkWidget *widget, gpointer data)
@ -402,11 +389,11 @@ click_try(GtkWidget *widget, gpointer data)
{
use_theme(rc, NULL);
}
gdk_error_warnings = 0;
gdk_error_trap_push ();
signal_apply_theme(widget);
gdk_flush();
/* system(cmd); */
gdk_error_warnings = 1;
gdk_error_trap_pop ();
}
static void
click_ok(GtkWidget *widget, gpointer data)
@ -444,10 +431,10 @@ click_revert(GtkWidget *widget, gpointer data)
* or if the theme has been set.. */
send_reread();
use_theme(rc, initial_font);
gdk_error_warnings = 0;
gdk_error_trap_push ();
signal_apply_theme(widget);
gdk_flush();
gdk_error_warnings = 1;
gdk_error_trap_pop ();
}
current_global_theme = initial_theme;
ignore_change = TRUE;

View file

@ -16,7 +16,7 @@ pixmap_DATA =
##
## You should not need to modify anything below this line
##
@XML_I18N_MERGE_DESKTOP_RULE@
@INTLTOOL_DESKTOP_RULE@
@GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)

View file

@ -27,7 +27,7 @@
#include <gtk/gtk.h>
#include <gnome.h>
#include <tree.h>
#include <libxml/tree.h>
#define PREFERENCES(obj) GTK_CHECK_CAST (obj, preferences_get_type (), Preferences)
#define PREFERENCES_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, preferences_get_type (), PreferencesClass)

View file

@ -10,7 +10,7 @@ pixmap_DATA =
##
## You should not need to modify anything below this line
##
@XML_I18N_MERGE_DESKTOP_RULE@
@INTLTOOL_DESKTOP_RULE@
@GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)

View file

@ -9,14 +9,16 @@ wm_properties_capplet_SOURCES = \
wm-properties.h \
wm-properties-capplet.c \
wm-list.c \
wm-exec.c
wm-exec.c \
gnome-startup.c \
gnome-startup.h
pixmap_DATA =
##
## You should not need to modify anything below this line
##
@XML_I18N_MERGE_DESKTOP_RULE@
@INTLTOOL_DESKTOP_RULE@
@GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)

View file

@ -18,4 +18,4 @@ $(desktop_in_files): %.desktop.in: %.desktop.in.in
sed s#Icon=#Icon=$(GNOMECC_ICONS_DIR)/# < $< > $@
$(desktop_files): %.desktop: %.desktop.in
$(top_builddir)/xml-i18n-merge -d $(top_srcdir)/po $< $@
$(top_builddir)/intltool-merge -d $(top_srcdir)/po $< $@

View file

@ -12,7 +12,7 @@
typedef struct _RestartInfo RestartInfo;
struct _RestartInfo {
GnomeDesktopEntry *dentry;
GnomeDesktopItem *dentry;
gint retries;
WMResultFunc callback;
gpointer data;
@ -22,26 +22,24 @@ gboolean
wm_is_running (void)
{
gboolean result;
gboolean old_warnings = gdk_error_warnings;
guint old_mask;
XWindowAttributes attrs;
gdk_error_warnings = FALSE;
gdk_error_code = 0;
gdk_error_trap_push ();
XGetWindowAttributes (GDK_DISPLAY(), GDK_ROOT_WINDOW(), &attrs);
XSelectInput (GDK_DISPLAY(), GDK_ROOT_WINDOW(),
SubstructureRedirectMask);
XSync (GDK_DISPLAY(), False);
if (gdk_error_code == 0) {
if (gdk_error_trap_pop () == 0) {
result = FALSE;
XSelectInput (GDK_DISPLAY(), GDK_ROOT_WINDOW(),
attrs.your_event_mask);
} else
result = TRUE;
gdk_error_warnings = old_warnings;
return result;
}
@ -56,31 +54,29 @@ find_gnome_wm_window(void)
unsigned long count;
unsigned long bytes_remain;
unsigned char *prop, *prop2;
gint prev_error;
GdkAtom cardinal_atom = gdk_atom_intern ("CARDINAL", FALSE);
prev_error = gdk_error_warnings;
gdk_error_warnings = 0;
gdk_error_trap_push ();
if (XGetWindowProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
gdk_atom_intern ("_WIN_SUPPORTING_WM_CHECK", FALSE),
0, 1, False, cardinal_atom,
gdk_x11_atom_to_xatom (gdk_atom_intern ("_WIN_SUPPORTING_WM_CHECK", FALSE)),
0, 1, False, gdk_x11_atom_to_xatom (cardinal_atom),
&r_type, &r_format,
&count, &bytes_remain, &prop) == Success && prop)
{
if (r_type == cardinal_atom && r_format == 32 && count == 1)
if (r_type == gdk_x11_atom_to_xatom (cardinal_atom) && r_format == 32 && count == 1)
{
Window n = *(long *)prop;
if (XGetWindowProperty(GDK_DISPLAY(), n,
gdk_atom_intern ("_WIN_SUPPORTING_WM_CHECK", FALSE),
0, 1, False, cardinal_atom,
gdk_x11_atom_to_xatom (gdk_atom_intern ("_WIN_SUPPORTING_WM_CHECK", FALSE)),
0, 1, False, gdk_x11_atom_to_xatom (cardinal_atom),
&r_type, &r_format, &count, &bytes_remain,
&prop2) == Success && prop)
{
if (r_type == cardinal_atom && r_format == 32 && count == 1)
if (r_type == gdk_x11_atom_to_xatom (cardinal_atom) && r_format == 32 && count == 1)
{
XFree(prop);
XFree(prop2);
gdk_error_warnings = prev_error;
gdk_error_trap_pop ();
return n;
}
XFree(prop2);
@ -88,7 +84,7 @@ find_gnome_wm_window(void)
}
XFree(prop);
}
gdk_error_warnings = prev_error;
gdk_error_trap_pop ();
return None;
}
@ -98,7 +94,7 @@ find_wm_window_from_client (GdkWindow *client)
Window window, frame, parent, root;
Window *children;
unsigned int nchildren;
gboolean old_warnings;
gboolean needs_pop = TRUE;
if (!client)
return None;
@ -106,14 +102,19 @@ find_wm_window_from_client (GdkWindow *client)
frame = None;
window = GDK_WINDOW_XWINDOW (client);
old_warnings = gdk_error_warnings;
gdk_error_warnings = FALSE;
gdk_error_code = 0;
gdk_error_trap_push ();
while (XQueryTree (GDK_DISPLAY(), window,
&root, &parent, &children, &nchildren) &&
(gdk_error_code == 0)) {
&root, &parent, &children, &nchildren))
{
if (gdk_error_trap_pop != 0)
{
needs_pop = FALSE;
break;
}
gdk_error_trap_push ();
if (children)
XFree(children);
@ -127,7 +128,8 @@ find_wm_window_from_client (GdkWindow *client)
window = parent;
}
gdk_error_warnings = old_warnings;
if (needs_pop)
gdk_error_trap_pop ();
return frame;
}
@ -142,7 +144,7 @@ window_has_wm_state (Window window)
unsigned char *prop;
if (XGetWindowProperty(GDK_DISPLAY(), window,
gdk_atom_intern ("WM_STATE", FALSE),
gdk_x11_atom_to_xatom (gdk_atom_intern ("WM_STATE", FALSE)),
0, 0, False, AnyPropertyType,
&r_type, &r_format,
&count, &bytes_remain, &prop) == Success) {
@ -191,16 +193,13 @@ find_wm_window_from_hunt (void)
Window parent, root, frame;
Window *children;
unsigned int nchildren;
gboolean old_warnings;
gint i;
frame = None;
old_warnings = gdk_error_warnings;
gdk_error_warnings = FALSE;
gdk_error_code = 0;
gdk_error_trap_push ();
XQueryTree (GDK_DISPLAY(), gdk_root_window,
XQueryTree (GDK_DISPLAY(), GDK_ROOT_WINDOW (),
&root, &parent, &children, &nchildren);
/* We are looking for a window that doesn't have WIN_STATE
@ -217,7 +216,7 @@ find_wm_window_from_hunt (void)
if (children)
XFree (children);
gdk_error_warnings = old_warnings;
gdk_error_trap_pop ();
return frame;
}
@ -248,7 +247,7 @@ start_timeout (gpointer data)
RestartInfo *info = data;
if (wm_is_running ()) {
info->callback(WM_SUCCESS, info->data);
gnome_desktop_entry_free (info->dentry);
gnome_desktop_item_unref (info->dentry);
g_free (info);
return FALSE;
} else {
@ -257,7 +256,7 @@ start_timeout (gpointer data)
return TRUE;
else {
info->callback(WM_CANT_START, info->data);
gnome_desktop_entry_free (info->dentry);
gnome_desktop_item_unref (info->dentry);
g_free (info);
return FALSE;
}
@ -267,7 +266,7 @@ start_timeout (gpointer data)
static void
start_do (RestartInfo *info)
{
gnome_desktop_entry_launch (info->dentry);
gnome_desktop_item_launch (info->dentry, 0, NULL, NULL);
info->retries = 10;
gtk_timeout_add (1000, start_timeout, info);
@ -286,7 +285,7 @@ kill_timeout (gpointer data)
return TRUE;
else {
info->callback(WM_ALREADY_RUNNING, info->data);
gnome_desktop_entry_free (info->dentry);
gnome_desktop_item_unref (info->dentry);
g_free (info);
return FALSE;
}
@ -305,7 +304,7 @@ wm_restart (WindowManager *new,
g_return_if_fail (new->is_present);
info = g_new (RestartInfo, 1);
info->dentry = gnome_desktop_entry_copy (new->dentry);
info->dentry = gnome_desktop_item_copy (new->dentry);
info->callback = callback;
info->data = data;
info->retries = 10;
@ -314,7 +313,7 @@ wm_restart (WindowManager *new,
wm_window = find_wm_window (client);
if (!wm_window) {
(*callback) (WM_ALREADY_RUNNING, data);
gnome_desktop_entry_free (info->dentry);
gnome_desktop_item_unref (info->dentry);
g_free (info);
} else {
XKillClient (GDK_DISPLAY(), wm_window);

View file

@ -45,13 +45,13 @@ wm_compare (gconstpointer a, gconstpointer b)
const WindowManager *wm_a = (const WindowManager *)a;
const WindowManager *wm_b = (const WindowManager *)b;
return g_strcasecmp (wm_a->dentry->name, wm_b->dentry->name);
return g_strcasecmp (gnome_desktop_item_get_string (wm_a->dentry, GNOME_DESKTOP_ITEM_NAME), gnome_desktop_item_get_string (wm_b->dentry, GNOME_DESKTOP_ITEM_NAME));
}
static void
wm_free (WindowManager *wm)
{
gnome_desktop_entry_free (wm->dentry);
gnome_desktop_item_unref (wm->dentry);
g_free (wm->config_exec);
g_free (wm->config_tryexec);;
g_free (wm);
@ -62,9 +62,9 @@ wm_check_present (WindowManager *wm)
{
gchar *path;
if (wm->dentry->exec) {
if (wm->dentry->tryexec) {
path = gnome_is_program_in_path (wm->dentry->tryexec);
if (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_EXEC)) {
if (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_TRY_EXEC)) {
path = gnome_is_program_in_path (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_TRY_EXEC));
wm->is_present = (path != NULL);
if (path)
g_free (path);
@ -95,7 +95,7 @@ wm_copy (WindowManager *wm)
{
WindowManager *result = g_new (WindowManager, 1);
result->dentry = gnome_desktop_entry_copy (wm->dentry);
result->dentry = gnome_desktop_item_copy (wm->dentry);
result->config_exec = g_strdup (wm->config_exec);
result->config_tryexec = g_strdup (wm->config_tryexec);
@ -114,7 +114,7 @@ wm_list_find (GList *list, gchar *name)
GList *tmp_list = list;
while (tmp_list) {
WindowManager *wm = tmp_list->data;
if (strcmp (wm->dentry->name, name) == 0)
if (strcmp (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_EXEC), name) == 0)
return wm;
tmp_list = tmp_list->next;
@ -129,9 +129,9 @@ wm_list_find_exec (GList *list, gchar *name)
GList *tmp_list = list;
while (tmp_list) {
WindowManager *wm = tmp_list->data;
if (!wm->dentry->exec || !wm->dentry->exec[0])
continue;
if (strcmp (wm->dentry->exec[0], name) == 0)
if (!gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_EXEC))
continue;
if (strcmp (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_EXEC), name) == 0)
return wm;
tmp_list = tmp_list->next;
@ -186,14 +186,15 @@ wm_list_read_dir (gchar *directory, gboolean is_user)
while (tmp_list) {
wm = g_new (WindowManager, 1);
wm->dentry = gnome_desktop_entry_load_unconditional (tmp_list->data);
wm->dentry = gnome_desktop_item_new_from_file (tmp_list->data, GNOME_DESKTOP_ITEM_TYPE_APPLICATION, NULL);
if (!wm->dentry) {
g_free (wm);
tmp_list = tmp_list->next;
continue;
}
prefix = g_strconcat ("=", wm->dentry->location, "=/Window Manager/", NULL);
prefix = g_strconcat ("=", gnome_desktop_item_get_location (wm->dentry), "=/Window Manager/", NULL);
gnome_config_push_prefix (prefix);
g_free (prefix);
@ -216,7 +217,7 @@ wm_list_read_dir (gchar *directory, gboolean is_user)
wm_check_present (wm);
if (wm->dentry->name && wm->dentry->exec &&
if (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_NAME) && gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_EXEC) &&
(wm->is_user || wm->is_present)) {
window_managers =
g_list_insert_sorted (window_managers,
@ -285,7 +286,7 @@ wm_list_init (void)
current_wm = window_managers->data;
if(current_wm)
current_wm_save = wm_list_find (window_managers_save, current_wm->dentry->name);
current_wm_save = wm_list_find (window_managers_save, gnome_desktop_item_get_string (current_wm->dentry, GNOME_DESKTOP_ITEM_NAME));
}
void
@ -324,9 +325,9 @@ wm_list_save (void)
wm = tmp_list->data;
if (wm->is_user) {
gnome_desktop_entry_save (wm->dentry);
gnome_desktop_item_save (wm->dentry, NULL, TRUE, NULL);
prefix = g_strconcat ("=", wm->dentry->location, "=/Window Manager/", NULL);
prefix = g_strconcat ("=", gnome_desktop_item_get_location (wm->dentry), "=/Window Manager/", NULL);
gnome_config_push_prefix (prefix);
g_free (prefix);
@ -345,7 +346,7 @@ wm_list_save (void)
*/
if(current_wm)
gnome_config_set_string ("wm-properties/Config/Config/Current",
current_wm->dentry->name);
gnome_desktop_item_get_string (current_wm->dentry, GNOME_DESKTOP_ITEM_NAME));
gnome_config_sync ();
}
@ -356,7 +357,7 @@ wm_list_revert (void)
gchar *old_name = NULL;
if(current_wm)
old_name = g_strdup (current_wm->dentry->name);
old_name = g_strdup (gnome_desktop_item_get_string (current_wm->dentry, GNOME_DESKTOP_ITEM_NAME));
g_list_foreach (window_managers, (GFunc)wm_free, NULL);
g_list_free (window_managers);
@ -414,7 +415,7 @@ WindowManager *
wm_list_get_revert (void)
{
if(current_wm_save)
return wm_list_find (window_managers, current_wm_save->dentry->name);
return wm_list_find (window_managers, gnome_desktop_item_get_string (current_wm_save->dentry, GNOME_DESKTOP_ITEM_NAME));
else
return NULL;
}
@ -430,10 +431,11 @@ wm_read_from_xml (xmlNodePtr wm_node)
wm = g_new0 (WindowManager, 1);
wm->dentry = gnome_desktop_entry_load_unconditional
(xmlGetProp (wm_node, "desktop-entry"));
wm->dentry = gnome_desktop_item_new_from_file
(xmlGetProp (wm_node, "desktop-entry"),
GNOME_DESKTOP_ITEM_TYPE_APPLICATION, NULL);
for (node = wm_node->childs; node; node = node->next) {
for (node = wm_node->children; node; node = node->next) {
if (!strcmp (node->name, "config-exec"))
wm->config_exec = xmlNodeGetContent (node);
else if (!strcmp (node->name, "config-tryexec"))
@ -450,7 +452,7 @@ wm_read_from_xml (xmlNodePtr wm_node)
if (wm->dentry == NULL ||
(wm->config_exec != NULL && is_blank (wm->config_exec)) ||
wm->dentry->name == NULL || wm->dentry->exec == NULL ||
gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_NAME) == NULL || gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_EXEC) == NULL ||
!(wm->is_user || wm->is_present))
{
g_free (wm);
@ -488,7 +490,7 @@ wm_write_to_xml (WindowManager *wm)
node = xmlNewNode (NULL, "window-manager");
xmlNewProp (node, "desktop-entry", wm->dentry->location);
xmlNewProp (node, "desktop-entry", gnome_desktop_item_get_location (wm->dentry));
if (wm->config_exec != NULL)
xmlNewChild (node, NULL, "config-exec", wm->config_exec);

View file

@ -10,7 +10,7 @@
#endif
#include <ctype.h>
#include <parser.h>
#include <libxml/parser.h>
#include "wm-properties.h"
#include "capplet-widget.h"
#include "gnome.h"
@ -20,6 +20,8 @@
# include <ximian-archiver/location.h>
#endif /* HAVE_XIMIAN_ARCHIVER */
#include "gnome-startup.h"
/* prototypes */
static void restart (gboolean force);
static void try_callback (void);
@ -329,10 +331,10 @@ update_gui (void)
if (wm == current_wm) {
row_text = g_strdup_printf (_("%s (Current)"),
wm->dentry->name);
gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_NAME));
tmpstr = g_strdup_printf (_("Run Configuration Tool for %s"),
wm->dentry->name);
gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_NAME));
gtk_label_set_text (GTK_LABEL (GTK_BIN (config_button)->child),
tmpstr);
@ -341,10 +343,10 @@ update_gui (void)
g_free (tmpstr);
} else if (wm->is_user && !wm->is_present) {
row_text = g_strconcat (wm->dentry->name,
row_text = g_strconcat (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_NAME),
_(" (Not found)"), NULL);
} else {
row_text = g_strdup (wm->dentry->name);
row_text = g_strdup (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_NAME));
}
new_row = gtk_clist_append (GTK_CLIST (clist), &row_text);
@ -469,8 +471,8 @@ restart_failure (WMResult reason)
case STATE_CANCEL:
msg = g_strdup_printf (_("Could not start '%s'.\n"
"Falling back to previous window manager '%s'\n"),
selected_wm?selected_wm->dentry->name:"Unknown",
current_wm?current_wm->dentry->name:"Unknown");
selected_wm?gnome_desktop_item_get_string (selected_wm->dentry, GNOME_DESKTOP_ITEM_NAME):"Unknown",
current_wm?gnome_desktop_item_get_string (current_wm->dentry, GNOME_DESKTOP_ITEM_NAME):"Unknown");
selected_wm = current_wm;
restart(TRUE);
break;
@ -610,12 +612,15 @@ restart (gboolean force)
{
WindowManager *current_wm = wm_list_get_current(), *mywm;
static gboolean last_try_was_twm = FALSE;
const char *twm_argv[] = {"twm", NULL};
const GnomeDesktopEntry twm_dentry = {"twm", "twm",
1, (char **)twm_argv, NULL,
NULL, NULL, 0, NULL,
NULL, NULL, 0, 0};
WindowManager twm_fallback = {(GnomeDesktopEntry*)&twm_dentry, "twm", "twm", 0, 0, 1, 0};
GnomeDesktopItem *twm_dentry = gnome_desktop_item_new ();
WindowManager twm_fallback = {twm_dentry, "twm", "twm", 0, 0, 1, 0};
gnome_desktop_item_set_string (twm_dentry,
GNOME_DESKTOP_ITEM_NAME, "twm");
gnome_desktop_item_set_string (twm_dentry,
GNOME_DESKTOP_ITEM_COMMENT, "twm");
gnome_desktop_item_set_string (twm_dentry,
GNOME_DESKTOP_ITEM_EXEC, "twm");
if(selected_wm) {
last_try_was_twm = FALSE;
@ -625,11 +630,12 @@ restart (gboolean force)
mywm = (WindowManager*)&twm_fallback;
} else {
restart_finalize();
gnome_desktop_item_unref (twm_dentry);
return;
}
if (force || current_wm != mywm) {
show_restart_dialog (mywm->dentry->name);
show_restart_dialog (gnome_desktop_item_get_string (mywm->dentry, GNOME_DESKTOP_ITEM_NAME));
if (state != STATE_OK && state != STATE_CANCEL)
gtk_widget_set_sensitive (capplet, FALSE);
restart_pending = TRUE;
@ -640,6 +646,8 @@ restart (gboolean force)
} else {
restart_finalize ();
}
gnome_desktop_item_unref (twm_dentry);
}
static void
@ -659,19 +667,7 @@ help_callback (void)
{
gchar *tmp;
tmp = gnome_help_file_find_file ("users-guide", "gccdesktop.html#GCCWM");
if (tmp) {
gnome_help_goto(0, tmp);
g_free(tmp);
} else {
GtkWidget *mbox;
mbox = gnome_message_box_new(_("No help is available/installed for these settings. Please make sure you\nhave the GNOME User's Guide installed on your system."),
GNOME_MESSAGE_BOX_ERROR,
_("Close"), NULL);
gtk_widget_show(mbox);
}
gnome_help_display_with_doc_id (gnome_program_get (), "users-guide", "gccdesktop.html", "#GCCWM", NULL);
}
static void
@ -906,25 +902,24 @@ static void
get_dialog_contents (WMDialog *dialog, WindowManager *wm)
{
gchar *tmp;
if (wm->dentry->name)
g_free (wm->dentry->name);
wm->dentry->name = extract_entry (dialog->name_entry);
tmp = extract_entry (dialog->name_entry);
gnome_desktop_item_set_string (wm->dentry, GNOME_DESKTOP_ITEM_NAME,
tmp);
g_free (tmp);
if (wm->dentry->exec)
g_strfreev (wm->dentry->exec);
tmp = extract_entry (dialog->exec_entry);
gnome_config_make_vector (tmp, &wm->dentry->exec_length,
&wm->dentry->exec);
gnome_desktop_item_set_string (wm->dentry, GNOME_DESKTOP_ITEM_EXEC,
tmp);
g_free (tmp);
if (wm->config_exec)
g_free (wm->config_exec);
wm->config_exec = extract_entry (dialog->config_entry);
if (wm->dentry->location)
g_free (wm->dentry->location);
wm->dentry->location = make_filename (wm->dentry->name);
tmp = make_filename (gnome_desktop_item_get_string (wm->dentry, GNOME_DESKTOP_ITEM_NAME));
gnome_desktop_item_set_location (wm->dentry, tmp);
g_free (tmp);
wm->session_managed = !!GTK_TOGGLE_BUTTON (dialog->sm_toggle)->active;
@ -943,15 +938,11 @@ edit_dialog (void)
dialog = create_dialog (_("Edit Window Manager"));
if (selected_wm->dentry->name)
gtk_entry_set_text (GTK_ENTRY (dialog->name_entry), selected_wm->dentry->name);
if (gnome_desktop_item_get_string (selected_wm->dentry, GNOME_DESKTOP_ITEM_NAME))
gtk_entry_set_text (GTK_ENTRY (dialog->name_entry), gnome_desktop_item_get_string (selected_wm->dentry, GNOME_DESKTOP_ITEM_NAME));
if (selected_wm->dentry->exec) {
tmp = gnome_config_assemble_vector (selected_wm->dentry->exec_length,
(const char **)selected_wm->dentry->exec);
gtk_entry_set_text (GTK_ENTRY (dialog->exec_entry), tmp);
g_free (tmp);
}
if (gnome_desktop_item_get_string (selected_wm->dentry, GNOME_DESKTOP_ITEM_EXEC))
gtk_entry_set_text (GTK_ENTRY (dialog->exec_entry), gnome_desktop_item_get_string (selected_wm->dentry, GNOME_DESKTOP_ITEM_EXEC));
if (selected_wm->config_exec)
gtk_entry_set_text (GTK_ENTRY (dialog->config_entry), selected_wm->config_exec);
@ -993,7 +984,7 @@ add_dialog (void)
if (result == 0) {
wm = g_new0 (WindowManager, 1);
wm->dentry = g_new0 (GnomeDesktopEntry, 1);
wm->dentry = gnome_desktop_item_new ();
get_dialog_contents (dialog, wm);
wm->is_user = TRUE;
@ -1241,7 +1232,7 @@ main (int argc, char **argv)
!wm_is_running()) {
wm_restart (selected_wm, NULL, init_callback,
g_strdup (selected_wm->dentry->name));
g_strdup (gnome_desktop_item_get_string (selected_wm->dentry, GNOME_DESKTOP_ITEM_NAME)));
gtk_main ();
}

View file

@ -7,13 +7,14 @@
#include <gdk/gdk.h>
#include <libgnome/libgnome.h>
#include <libgnome/gnome-desktop-item.h>
#include <tree.h>
#include <libxml/tree.h>
typedef struct _WindowManager WindowManager;
struct _WindowManager {
GnomeDesktopEntry *dentry;
GnomeDesktopItem *dentry;
gchar *config_exec;
gchar *config_tryexec;
gboolean session_managed : 1;