Show current project name in window title.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1582 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
0e9a9ebbf6
commit
b4dc6feabc
@ -1,7 +1,15 @@
|
||||
2007-05-28 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
|
||||
* src/project.c, src/document.c, src/ui_utils.c:
|
||||
Show current project name in window title.
|
||||
|
||||
|
||||
2007-05-26 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
|
||||
* src/treeviews.c, src/filetypes.c, src/filetypes.h, src/document.c:
|
||||
Replace filetype::has_tags member with filetype_has_tags().
|
||||
* HACKING:
|
||||
Add note about Adding a TagManager parser.
|
||||
|
||||
|
||||
2007-05-26 Enrico Tröger <enrico.troeger@uvena.de>
|
||||
|
@ -148,12 +148,16 @@ gint document_get_n_idx(guint page_num)
|
||||
gint document_get_cur_idx()
|
||||
{
|
||||
gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
|
||||
ScintillaObject *sci = (ScintillaObject*)gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->notebook), cur_page);
|
||||
|
||||
if (cur_page == -1)
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
ScintillaObject *sci = (ScintillaObject*)
|
||||
gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->notebook), cur_page);
|
||||
|
||||
return document_find_by_sci(sci);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,6 +277,14 @@ void project_open()
|
||||
}
|
||||
|
||||
|
||||
// Called when opening, closing and updating projects.
|
||||
static void update_ui()
|
||||
{
|
||||
ui_set_window_title(-1);
|
||||
build_menu_update(-1);
|
||||
}
|
||||
|
||||
|
||||
void project_close()
|
||||
{
|
||||
g_return_if_fail(app->project != NULL);
|
||||
@ -295,7 +303,7 @@ void project_close()
|
||||
g_free(app->project);
|
||||
app->project = NULL;
|
||||
|
||||
build_menu_update(-1);
|
||||
update_ui();
|
||||
}
|
||||
|
||||
|
||||
@ -474,7 +482,7 @@ void project_properties()
|
||||
if (! update_config(e))
|
||||
goto retry;
|
||||
// successfully updated properties
|
||||
build_menu_update(-1);
|
||||
update_ui();
|
||||
}
|
||||
|
||||
gtk_widget_destroy(e->dialog);
|
||||
@ -807,7 +815,7 @@ static gboolean load_config(const gchar *filename)
|
||||
|
||||
g_key_file_free(config);
|
||||
|
||||
build_menu_update(-1);
|
||||
update_ui();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "images.c"
|
||||
#include "treeviews.h"
|
||||
#include "win32.h"
|
||||
#include "project.h"
|
||||
|
||||
|
||||
static gchar *menu_item_get_text(GtkMenuItem *menu_item);
|
||||
@ -149,32 +150,42 @@ void ui_update_statusbar(gint idx, gint pos)
|
||||
/* This sets the window title according to the current filename. */
|
||||
void ui_set_window_title(gint idx)
|
||||
{
|
||||
gchar *title;
|
||||
GString *str;
|
||||
GeanyProject *project = app->project;
|
||||
|
||||
if (idx < 0)
|
||||
idx = document_get_cur_idx();
|
||||
|
||||
str = g_string_new(NULL);
|
||||
|
||||
if (idx >= 0)
|
||||
{
|
||||
g_string_append(str, doc_list[idx].changed ? "*" : "");
|
||||
|
||||
if (doc_list[idx].file_name == NULL)
|
||||
{
|
||||
title = g_strdup_printf("%s%s - Geany",
|
||||
doc_list[idx].changed ? "*" : "",
|
||||
DOC_FILENAME(idx));
|
||||
}
|
||||
g_string_append(str, DOC_FILENAME(idx));
|
||||
else
|
||||
{
|
||||
gchar *basename = g_path_get_basename(DOC_FILENAME(idx));
|
||||
gchar *dirname = g_path_get_dirname(DOC_FILENAME(idx));
|
||||
|
||||
title = g_strdup_printf("%s%s - %s - Geany",
|
||||
doc_list[idx].changed ? "*" : "",
|
||||
basename, dirname ? dirname : "");
|
||||
g_string_append(str, basename);
|
||||
g_string_append(str, " - ");
|
||||
g_string_append(str, dirname ? dirname : "");
|
||||
g_free(basename);
|
||||
g_free(dirname);
|
||||
}
|
||||
gtk_window_set_title(GTK_WINDOW(app->window), title);
|
||||
g_free(title);
|
||||
g_string_append(str, " - ");
|
||||
}
|
||||
else
|
||||
gtk_window_set_title(GTK_WINDOW(app->window), "Geany");
|
||||
if (project)
|
||||
{
|
||||
g_string_append_c(str, '[');
|
||||
g_string_append(str, project->name);
|
||||
g_string_append(str, "] - ");
|
||||
}
|
||||
g_string_append(str, "Geany");
|
||||
gtk_window_set_title(GTK_WINDOW(app->window), str->str);
|
||||
g_string_free(str, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user