Commit 2c55d222 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Some more fixes...

parent e4899485
......@@ -28,7 +28,7 @@
o Fixed a bug where the loaded project title apears as
unsaved.
* src/glade-utils.c: Added comments.
* src/glade-utils.c: Added comments, changed 'char' --> 'gchar'
* widgets/gtk+.xml.in: Removed mention of the get_anarchist_children func,
override the get_children func for GtkCombo to additionally return the
......@@ -36,6 +36,15 @@
Also added a gtk_container_remove remove-function for GtkListItem since
it seemed to be empty and causing errors.
* src/glade-project.c:
o Fixed glade_project_write() to count the required libs in the GList
before freeing the GList (was SEGFAULT on save of any projects useing
extra libs).
o Made glade_project_display_name() take a "mnemonic" arg... to escape
any underscores when setting the display name in a mnemonic label.
o Fixed a bug where projects with required added libs where segfaulting
at save time.
2006-03-15 Vincent Geddes <vgeddes@metroweb.co.za>
* src/glade-project.c: Improved name generation for new empty projects.
......
......@@ -335,7 +335,9 @@ glade_project_view_close_cb (GladeProject *project,
pdata->view->project_data =
g_list_remove (pdata->view->project_data, pdata);
glade_project_view_set_project (pdata->view, NULL);
/* Clear project view if the closing project is current */
if (pdata->project == pdata->view->project)
glade_project_view_set_project (pdata->view, NULL);
gpv_project_data_free (pdata);
}
......
......@@ -84,7 +84,7 @@ gpw_refresh_title (GladeProjectWindow *gpw)
active_project = glade_app_get_active_project (GLADE_APP (gpw));
if (active_project)
{
disp = glade_project_display_name (active_project, TRUE, FALSE);
disp = glade_project_display_name (active_project, TRUE, FALSE, FALSE);
title = g_strdup_printf ("%s - %s", WINDOW_TITLE, disp);
g_free (disp);
}
......@@ -243,21 +243,19 @@ static void
gpw_refresh_projects_list_item (GladeProjectWindow *gpw, GladeProject *project)
{
GtkAction *action;
gchar *project_name, *final_project_name;
gchar *project_name;
/* Get associated action */
action = GTK_ACTION (g_object_get_data (G_OBJECT (project), "project-list-action"));
/* Set action label */
project_name = glade_project_display_name (project, TRUE, TRUE);
final_project_name = glade_util_duplicate_underscores (project_name);
g_object_set (action, "label", final_project_name, NULL);
project_name = glade_project_display_name (project, TRUE, TRUE, TRUE);
g_object_set (action, "label", project_name, NULL);
/* Set action tooltip */
g_object_set (action, "tooltip", project->path, NULL);
g_free (project_name);
g_free (final_project_name);
}
......@@ -338,7 +336,7 @@ gpw_refresh_projects_list_menu (GladeProjectWindow *gpw)
project = GLADE_PROJECT (l->data);
action_name = g_strdup_printf ("Project_%d", i);
project_name = glade_project_display_name (project, TRUE, TRUE);
project_name = glade_project_display_name (project, TRUE, TRUE, TRUE);
action = gtk_radio_action_new (action_name, project_name, project->path, NULL, i);
/* Link action and project */
......@@ -451,7 +449,7 @@ gpw_save (GladeProjectWindow *gpw, GladeProject *project, const gchar *path)
glade_app_update_instance_count (GLADE_APP (gpw), project);
/* Get display_name here, it could have changed with "Save As..." */
display_name = glade_project_display_name (project, FALSE, FALSE),
display_name = glade_project_display_name (project, FALSE, FALSE, FALSE),
gpw_recent_project_add (gpw, project->path);
gpw_recent_project_config_save (gpw);
......
......@@ -1030,10 +1030,10 @@ glade_project_write (GladeProject *project)
for (i = 0, list = required; list; i++, list = list->next)
strv[i] = g_strdup (list->data);
g_list_free (required);
interface->n_requires = g_list_length (required);
interface->requires = strv;
g_list_free (required);
}
for (i = 0, list = project->objects; list; list = list->next)
......@@ -1554,6 +1554,8 @@ glade_project_list_resources (GladeProject *project)
* of projects with unsaved changes
* @tab_aligned: whether to prepend a tab and align unsaved
* names using the tab (for the project menu)
* @mnemonic: Pass %TRUE here if you are going to use this in
* a mnemonic label... this will escape the underscores nicely.
*
* Returns: A newly allocated string to uniquely
* describe this open project.
......@@ -1562,7 +1564,8 @@ glade_project_list_resources (GladeProject *project)
gchar *
glade_project_display_name (GladeProject *project,
gboolean unsaved_changes,
gboolean tab_aligned)
gboolean tab_aligned,
gboolean mnemonic)
{
const gchar *prefix = tab_aligned ? "\t" : "";
const gchar *unsaved_prefix = unsaved_changes ?
......@@ -1586,6 +1589,13 @@ glade_project_display_name (GladeProject *project,
else
final_name = prefixed_name;
if (mnemonic)
{
prefixed_name = glade_util_duplicate_underscores (final_name);
g_free (final_name);
return prefixed_name;
}
return final_name;
}
......
......@@ -156,7 +156,8 @@ gchar *glade_project_resource_fullpath (GladeProject *project,
LIBGLADEUI_API
gchar *glade_project_display_name (GladeProject *project,
gboolean unsaved_changes,
gboolean tab_aligned);
gboolean tab_aligned,
gboolean mnemonic);
LIBGLADEUI_API
gboolean glade_project_is_loading (GladeProject *project);
......
......@@ -564,13 +564,13 @@ glade_util_replace (gchar *str, gchar a, gchar b)
*
* Returns: a newly allocated string
*/
char *
glade_util_duplicate_underscores (const char *name)
gchar *
glade_util_duplicate_underscores (const gchar *name)
{
const char *tmp;
const char *last_tmp = name;
char *underscored_name = g_malloc (strlen (name) * 2 + 1);
char *tmp_underscored = underscored_name;
const gchar *tmp;
const gchar *last_tmp = name;
gchar *underscored_name = g_malloc (strlen (name) * 2 + 1);
gchar *tmp_underscored = underscored_name;
for (tmp = last_tmp; *tmp; tmp = g_utf8_next_char (tmp))
{
......
......@@ -58,7 +58,7 @@ GtkWidget *glade_util_file_dialog_new (const gchar *title,
LIBGLADEUI_API
void glade_util_replace (char *str, char a, char b);
LIBGLADEUI_API
gchar *glade_util_duplicate_underscores (const char *name);
gchar *glade_util_duplicate_underscores (const gchar *name);
LIBGLADEUI_API
void glade_util_add_selection (GtkWidget *widget);
......
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