Commit fe399963 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

Increase the paranoia level when dealing with strings. Add an assload of

Tue May 08 12:41:41 2001  George Lebl <jirka@5z.com>

	* extern.c, foobar-widget.c, gnome-panel-properties.c, launcher.c,
	  logout.c, menu-rh.c, menu.c, panel-util.c, panel.c:  Increase
	  the paranoia level when dealing with strings.  Add an assload of
	  checks for NULLs some preconditions asserts and warnings, possibly
	  fixing some cornercase crashes.

	* foobar-widget.c: Fix the "clicked on foobar tasklist and things
	  crashed" bug

	* menu-fentry.c:  Fix the crashes on startup bug (the /tmp/languages
	  bug).  I should be publically flogged for this one.
parent 1956bc09
Tue May 08 12:41:41 2001 George Lebl <jirka@5z.com>
* extern.c, foobar-widget.c, gnome-panel-properties.c, launcher.c,
logout.c, menu-rh.c, menu.c, panel-util.c, panel.c: Increase
the paranoia level when dealing with strings. Add an assload of
checks for NULLs some preconditions asserts and warnings, possibly
fixing some cornercase crashes.
* foobar-widget.c: Fix the "clicked on foobar tasklist and things
crashed" bug
* menu-fentry.c: Fix the crashes on startup bug (the /tmp/languages
bug). I should be publically flogged for this one.
Tue May 08 01:45:32 2001 George Lebl <jirka@5z.com>
* launcher.c: some cleanup, and be paranoid about dentry we get
......
Tue May 08 12:41:41 2001 George Lebl <jirka@5z.com>
* extern.c, foobar-widget.c, gnome-panel-properties.c, launcher.c,
logout.c, menu-rh.c, menu.c, panel-util.c, panel.c: Increase
the paranoia level when dealing with strings. Add an assload of
checks for NULLs some preconditions asserts and warnings, possibly
fixing some cornercase crashes.
* foobar-widget.c: Fix the "clicked on foobar tasklist and things
crashed" bug
* menu-fentry.c: Fix the crashes on startup bug (the /tmp/languages
bug). I should be publically flogged for this one.
Tue May 08 01:45:32 2001 George Lebl <jirka@5z.com>
* launcher.c: some cleanup, and be paranoid about dentry we get
......
......@@ -800,6 +800,12 @@ get_us_position (const int panel, const int pos, const char *goad_id, int *newpo
*newpos = pos;
/* Sanity? can this ever happen? */
if (goad_id == NULL) {
g_warning ("get_us_position: goad_id == NULL, bad bad");
goad_id = "foo";
}
if (panel < 0 || pos < 0) {
char *key = g_strdup_printf ("%sApplet_Position_Memory/%s/",
PANEL_CONFIG_PATH,
......@@ -1991,6 +1997,9 @@ extern_save_last_position (Extern *ext, gboolean sync)
int panel_num;
AppletData *ad;
if (ext->goad_id == NULL)
return;
/* Here comes a hack. We probably want the next applet to load at
* a similar location. If none is given. Think xchat, or any
* app that just adds applets on it's own by just running them. */
......
......@@ -695,6 +695,7 @@ add_task (GwmhTask *task, FoobarWidget *foo)
char *title = NULL;
int slen;
GtkWidget *pixmap = NULL;
char *name;
static GwmhDesk *desk = NULL;
......@@ -702,15 +703,22 @@ add_task (GwmhTask *task, FoobarWidget *foo)
if (GWMH_TASK_SKIP_WINLIST (task))
return;
/*g_message ("task: %s", task->name);*/
if (task->name != NULL) {
slen = strlen (task->name);
if (slen > 443)
title = g_strdup_printf ("%.420s...%s", task->name, task->name+slen-20);
else
title = g_strdup (task->name);
} else {
/* Translators: Task with no name, should not really happen, so
* this should signal that the panel is confused by this task
* (thus question marks) */
title = g_strdup (_("???"));
}
if (GWMH_TASK_ICONIFIED (task)) {
char *tmp = title;
title = g_strdup_printf ("[%s]", title ? title : task->name);
if (tmp)
title = g_strdup_printf ("[%s]", title);
g_free (tmp);
}
......@@ -722,7 +730,7 @@ add_task (GwmhTask *task, FoobarWidget *foo)
pixmap);
}
label = gtk_label_new (title ? title : task->name);
label = gtk_label_new (title);
g_free (title);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
......@@ -868,7 +876,7 @@ task_notify (gpointer data, GwmhTask *task,
gtk_widget_hide (item);
} else {
g_warning ("Could not find item for task '%s'",
task->name);
sure_string (task->name));
}
}
break;
......
......@@ -1238,6 +1238,9 @@ loadup_vals (void)
int i;
gboolean def;
/* look at tile_def, this asserts 4 */
g_assert (LAST_TILE == 4);
buf = g_string_new(NULL);
/*set up global options*/
......
......@@ -1238,6 +1238,9 @@ loadup_vals (void)
int i;
gboolean def;
/* look at tile_def, this asserts 4 */
g_assert (LAST_TILE == 4);
buf = g_string_new(NULL);
/*set up global options*/
......
......@@ -472,7 +472,9 @@ properties_apply (Launcher *launcher)
g_free (docpath);
title = g_strdup_printf (_("Help on %s"),
launcher->dentry->name);
launcher->dentry->name != NULL ?
launcher->dentry->name :
_("Application"));
applet_add_callback (launcher->info, "help_on_app",
GNOME_STOCK_PIXMAP_HELP,
......@@ -663,7 +665,9 @@ load_launcher_applet_full (const char *params, GnomeDesktopEntry *dentry,
g_free (docpath);
title = g_strdup_printf (_("Help on %s"),
launcher->dentry->name);
launcher->dentry->name != NULL ?
launcher->dentry->name :
_("Application"));
applet_add_callback (applets_last->data, "help_on_app",
GNOME_STOCK_PIXMAP_HELP,
......@@ -863,7 +867,8 @@ convert_dentry_to_gnome (GnomeDesktopEntry *dentry)
if (strcmp (dentry->exec[i], "\"%c\"") == 0 ||
strcmp (dentry->exec[i], "%c") == 0) {
g_free (dentry->exec[i]);
dentry->exec[i] = g_strdup_printf ("'%s'", dentry->name);
dentry->exec[i] = g_strdup_printf ("'%s'",
sure_string (dentry->name));
} else if (dentry->exec[i][0] == '%' &&
strlen(dentry->exec[i]) == 2) {
g_free (dentry->exec[i]);
......@@ -921,6 +926,7 @@ launcher_file_name (const char *base)
#warning FIXME: per session config must be done for launchers
#endif
#else
g_return_val_if_fail (base != NULL, NULL);
return g_strdup_printf ("%s/.gnome/panel.d/default/launchers/%s",
g_get_home_dir (),
base);
......
......@@ -44,6 +44,8 @@ drag_data_get_cb (GtkWidget *widget,
char *type = data;
char *foo;
g_return_if_fail (type != NULL);
foo = g_strdup_printf ("%s:%d", type, find_applet (widget));
gtk_selection_data_set (selection_data,
......
......@@ -38,20 +38,6 @@ extern char *merge_merge_dir;
extern GlobalConfig global_config;
static void
print_languages (void)
{
FILE *out = fopen ("/tmp/languages", "a");
GList *list = gnome_i18n_get_language_list ("LC_MESSAGES");
fprintf (out, "START\n");
while (list) {
fprintf (out, "%s\n", (char *)list->data);
list = list->next;
}
fprintf (out, "END\n");
fclose (out);
}
void
init_fr_chunks (void)
{
......@@ -434,7 +420,6 @@ fr_fill_dir(FileRec *fr, int sublevels)
tryexec_path = NULL;
dentry = gnome_desktop_entry_load_unconditional (name);
print_languages ();
if (dentry != NULL &&
dentry->tryexec != NULL) {
tryexec_path = panel_is_program_in_path (dentry->tryexec);
......@@ -542,7 +527,6 @@ fr_read_dir (DirRec *dr, const char *mdir, struct stat *dstat,
stat (fname, &s) != -1) {
GnomeDesktopEntry *dentry;
dentry = gnome_desktop_entry_load(fname);
print_languages ();
if (dentry != NULL) {
g_free (fr->icon);
fr->icon = dentry->icon;
......@@ -707,7 +691,6 @@ fr_check_and_reread (FileRec *fr)
if(ddr->dentrymtime != s.st_mtime) {
GnomeDesktopEntry *dentry;
dentry = gnome_desktop_entry_load(p);
print_languages ();
if(dentry) {
g_free(ffr->icon);
ffr->icon = dentry->icon;
......@@ -742,7 +725,6 @@ fr_check_and_reread (FileRec *fr)
if(ffr->mtime != s.st_mtime) {
GnomeDesktopEntry *dentry;
dentry = gnome_desktop_entry_load(ffr->name);
print_languages ();
if (dentry != NULL) {
/* take over memory */
g_free (ffr->icon);
......
......@@ -298,7 +298,7 @@ make_rh_submenu(char *dir, GSList *rhlist)
p = g_concat_dir_and_file(dir,s);
g_free(s);
if(fp) fprintf(fp,"%s\n",g_basename(p));
if(fp) fprintf(fp,"%s\n",sure_string(g_basename(p)));
mkdir(p,0755);
dentry.location = g_concat_dir_and_file(p,".directory");
......
......@@ -318,7 +318,8 @@ copy_fr_dir (DirRec *dr, const char *to)
continue;
}
if (order_file != NULL)
if (order_file != NULL &&
g_basename (fr->name) != NULL)
fprintf (order_file, "%s\n", g_basename (fr->name));
}
......@@ -727,6 +728,8 @@ really_add_new_menu_item (GtkWidget *d, int button, gpointer data)
return;
}
g_return_if_fail (dir != NULL);
dentry = gnome_dentry_get_dentry (dedit);
if(dentry->exec == NULL ||
......@@ -747,6 +750,11 @@ really_add_new_menu_item (GtkWidget *d, int button, gpointer data)
int i = 2;
char *name = g_strdup (dentry->name);
if (string_empty (name)) {
g_free (name);
name = g_strdup ("huh-no-name");
}
validate_for_filename (name);
dentry->location = g_strdup_printf ("%s/%s.desktop",
......@@ -761,7 +769,7 @@ really_add_new_menu_item (GtkWidget *d, int button, gpointer data)
g_free (name);
}
g_print ("location: %s\n", dentry->location);
g_assert (dentry->location != NULL);
file = g_concat_dir_and_file (dir, ".order");
fp = fopen (file, "a");
......@@ -1644,7 +1652,9 @@ show_item_menu (GtkWidget *item, GdkEventButton *bevent, ShowItemMenu *sim)
menuitem = gtk_menu_item_new ();
gtk_widget_lock_accelerators (menuitem);
title = g_strdup_printf (_("Help on %s"),
ii->name);
ii->name != NULL ?
ii->name :
_("Application"));
setup_menuitem (menuitem, 0, title);
g_free (title);
gtk_menu_append (GTK_MENU (sim->menu),
......
......@@ -822,9 +822,14 @@ panel_error_dialog (const char *format, ...)
char *s;
va_list ap;
if (format == NULL) {
g_warning ("NULL error dialog");
s = g_strdup ("(null)");
} else {
va_start (ap, format);
s = g_strdup_vprintf (format, ap);
va_end (ap);
}
w = gnome_error_dialog (s);
g_free (s);
......
......@@ -942,12 +942,16 @@ extract_filename (const gchar* uri)
}
static void
drop_url(PanelWidget *panel, int pos, char *url)
drop_url(PanelWidget *panel, int pos, const char *url)
{
char *p = g_strdup_printf (_("Open URL: %s"), url);
char *p;
g_return_if_fail (url != NULL);
p = g_strdup_printf (_("Open URL: %s"), url);
load_launcher_applet_from_info_url (url, p, url, "gnome-globe.png",
panel, pos, TRUE);
g_free(p);
g_free (p);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment