|
GnuCash 2.3.0
|
Data Structures | |
| struct | GncPluginFileHistoryPrivate |
| struct | GncPluginFileHistory |
| struct | GncPluginFileHistoryClass |
Files | |
| file | gnc-plugin-file-history.c |
Functions providing the file history menu. | |
| file | gnc-plugin-file-history.h |
Functions providing the file history menu. | |
Defines | |
| #define | FILENAME_STRING "filename" |
| #define | PLUGIN_ACTIONS_NAME "gnc-plugin-file-history-actions" |
| #define | PLUGIN_UI_FILENAME "gnc-plugin-file-history-ui.xml" |
| #define | GNOME1_HISTORY "History" |
| #define | GNOME1_MAXFILES "MaxFiles" |
| #define | GNC_PLUGIN_FILE_HISTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_FILE_HISTORY, GncPluginFileHistoryPrivate)) |
| #define | GNC_TYPE_PLUGIN_FILE_HISTORY (gnc_plugin_file_history_get_type ()) |
| #define | GNC_PLUGIN_FILE_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_FILE_HISTORY, GncPluginFileHistory)) |
| #define | GNC_PLUGIN_FILE_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_FILE_HISTORY, GncPluginFileHistoryClass)) |
| #define | GNC_IS_PLUGIN_FILE_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_FILE_HISTORY)) |
| #define | GNC_IS_PLUGIN_FILE_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_FILE_HISTORY)) |
| #define | GNC_PLUGIN_FILE_HISTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_FILE_HISTORY, GncPluginFileHistoryClass)) |
| #define | GNC_PLUGIN_FILE_HISTORY_NAME "gnc-plugin-file-history" |
| #define | MAX_HISTORY_FILES 10 |
| #define | HISTORY_STRING_SECTION "history" |
| #define | HISTORY_STRING_MAXFILES "maxfiles" |
| #define | HISTORY_STRING_FILE_N "file%d" |
Typedefs | |
| typedef struct GncPluginFileHistoryPrivate | GncPluginFileHistoryPrivate |
Functions | |
| void | gnc_history_add_file (const char *newfile) |
| void | gnc_history_remove_file (const char *oldfile) |
| char * | gnc_history_get_last (void) |
| GType | gnc_plugin_file_history_get_type (void) |
| GncPlugin * | gnc_plugin_file_history_new (void) |
| #define PLUGIN_ACTIONS_NAME "gnc-plugin-file-history-actions" |
The label given to the main window for this plugin.
Definition at line 68 of file gnc-plugin-file-history.c.
| #define PLUGIN_UI_FILENAME "gnc-plugin-file-history-ui.xml" |
The name of the UI description file for this plugin.
Definition at line 70 of file gnc-plugin-file-history.c.
| typedef struct GncPluginFileHistoryPrivate GncPluginFileHistoryPrivate |
The instance private data for a file history plugin. This data structure is unused.
| void gnc_history_add_file | ( | const char * | filename | ) |
Add a file name to the front of the file "history list". If the name already exist on the list, then it is moved from its current location to the front of the list. The "list" is actually a sequence of up to ten gconf keys.
| filename | The name of the file to add to the list. |
Definition at line 155 of file gnc-plugin-file-history.c.
{
gchar *filename, *from, *to;
gint i, last;
if (newfile == NULL)
return;
if (!g_utf8_validate(newfile, -1, NULL))
return;
/*
* Look for the filename in gconf.
*/
last = MAX_HISTORY_FILES - 1;
for (i = 0; i < MAX_HISTORY_FILES; i++)
{
from = gnc_history_gconf_index_to_key(i);
filename = gnc_gconf_get_string(HISTORY_STRING_SECTION, from, NULL);
g_free(from);
if (!filename)
{
last = i;
break;
}
if (g_utf8_collate(newfile, filename) == 0)
{
g_free(filename);
last = i;
break;
}
g_free(filename);
}
/*
* Shuffle filenames upward through gconf.
*/
to = gnc_history_gconf_index_to_key(last);
for (i = last - 1; i >= 0; i--)
{
from = gnc_history_gconf_index_to_key(i);
filename = gnc_gconf_get_string(HISTORY_STRING_SECTION, from, NULL);
if (filename)
{
gnc_gconf_set_string(HISTORY_STRING_SECTION, to, filename, NULL);
g_free(filename);
}
else
{
gnc_gconf_unset(HISTORY_STRING_SECTION, to, NULL);
}
g_free(to);
to = from;
}
/*
* Store the new zero entry.
*/
gnc_gconf_set_string(HISTORY_STRING_SECTION, to, newfile, NULL);
g_free(to);
}
| char * gnc_history_get_last | ( | void | ) |
Retrieve the name of the file most recently accessed. This is the name at the front of the list. Since the "list" is actually a sequence of up to ten gconf keys, this is the value of key zero.
Definition at line 266 of file gnc-plugin-file-history.c.
{
char *filename, *key;
key = gnc_history_gconf_index_to_key(0);
filename = gnc_gconf_get_string(HISTORY_STRING_SECTION, key, NULL);
g_free(key);
return filename;
}
| void gnc_history_remove_file | ( | const char * | oldfile | ) |
Remove all occurences of a file name from the history list. Move the other key values up in the list to fill the gaps.
| oldfile | The name of the file to remove from the list. |
Definition at line 224 of file gnc-plugin-file-history.c.
{
gchar *filename, *from, *to;
gint i, j;
if (!oldfile)
return;
if (!g_utf8_validate(oldfile, -1, NULL))
return;
for (i = 0, j = 0; i < MAX_HISTORY_FILES; i++)
{
from = gnc_history_gconf_index_to_key(i);
filename = gnc_gconf_get_string(HISTORY_STRING_SECTION, from, NULL);
if (filename)
{
if (g_utf8_collate(oldfile, filename) == 0)
{
gnc_gconf_unset(HISTORY_STRING_SECTION, from, NULL);
}
else
{
if (i != j)
{
to = gnc_history_gconf_index_to_key(j);
gnc_gconf_set_string(HISTORY_STRING_SECTION, to, filename, NULL);
gnc_gconf_unset(HISTORY_STRING_SECTION, from, NULL);
g_free(to);
}
j++;
}
}
g_free(from);
}
}
| GType gnc_plugin_file_history_get_type | ( | void | ) |
Get the type of a file history plugin.
Definition at line 544 of file gnc-plugin-file-history.c.
{
static GType gnc_plugin_file_history_type = 0;
if (gnc_plugin_file_history_type == 0)
{
static const GTypeInfo our_info =
{
sizeof (GncPluginFileHistoryClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gnc_plugin_file_history_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GncPluginFileHistory),
0,
(GInstanceInitFunc) gnc_plugin_file_history_init
};
gnc_plugin_file_history_type =
g_type_register_static (GNC_TYPE_PLUGIN,
"GncPluginFileHistory",
&our_info, 0);
}
return gnc_plugin_file_history_type;
}
| GncPlugin * gnc_plugin_file_history_new | ( | void | ) |
Create a new file history plugin. This plugin attaches the file history menu to any window that is opened.
Definition at line 638 of file gnc-plugin-file-history.c.
1.7.4