Files | |
| file | gnc-plugin-file-history.h |
| Utility functions for writing import modules. | |
Data Structures | |
| struct | GncPluginFileHistoryPrivate |
| struct | GncPluginFileHistory |
| struct | GncPluginFileHistoryClass |
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 | 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 GncPluginFileHistoryPrivate | GncPluginFileHistoryPrivate |
Functions | |
| void | gnc_history_add_file (const char *newfile) |
| char * | gnc_history_get_last (void) |
| GType | gnc_plugin_file_history_get_type (void) |
| GncPlugin * | gnc_plugin_file_history_new (void) |
|
|
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.
Definition at line 98 of file gnc-plugin-file-history.c. 00099 { 00100 gchar *filename, *from, *to; 00101 gint i, last; 00102 00103 if (newfile == NULL) 00104 return; 00105 if (!g_utf8_validate(newfile, -1, NULL)) 00106 return; 00107 00108 /* 00109 * Look for the filename in gconf. 00110 */ 00111 last = MAX_HISTORY_FILES - 1; 00112 for (i = 0; i < MAX_HISTORY_FILES; i++) { 00113 from = g_strdup_printf(HISTORY_STRING_FILE_N, i); 00114 filename = gnc_gconf_get_string(HISTORY_STRING_SECTION, from, NULL); 00115 g_free(from); 00116 00117 if (!filename) { 00118 last = i; 00119 break; 00120 } 00121 if (g_utf8_collate(newfile, filename) == 0) { 00122 g_free(filename); 00123 last = i; 00124 break; 00125 } 00126 g_free(filename); 00127 } 00128 00129 /* 00130 * Shuffle filenames upward through gconf. 00131 */ 00132 to = g_strdup_printf(HISTORY_STRING_FILE_N, last); 00133 for (i = last - 1; i >= 0; i--) { 00134 from = g_strdup_printf(HISTORY_STRING_FILE_N, i); 00135 filename = gnc_gconf_get_string(HISTORY_STRING_SECTION, from, NULL); 00136 if (filename) { 00137 gnc_gconf_set_string(HISTORY_STRING_SECTION, to, filename, NULL); 00138 g_free(filename); 00139 } else { 00140 gnc_gconf_unset(HISTORY_STRING_SECTION, to, NULL); 00141 } 00142 g_free(to); 00143 to = from; 00144 } 00145 00146 /* 00147 * Store the new zero entry. 00148 */ 00149 gnc_gconf_set_string(HISTORY_STRING_SECTION, to, newfile, NULL); 00150 }
|
|
|
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 158 of file gnc-plugin-file-history.c. 00159 { 00160 static char *filename = NULL; 00161 char *key; 00162 00163 /* The static string supports the current signature of this 00164 * function. At some point this should be changed to pass the 00165 * allocated string up to the caller and make them responsible for 00166 * freeing irt, but that change percolates up into the scheme code 00167 * and requires changing that as well. */ 00168 if (filename) { 00169 g_free(filename); 00170 filename = NULL; 00171 } 00172 00173 key = g_strdup_printf(HISTORY_STRING_FILE_N, 0); 00174 filename = gnc_gconf_get_string(HISTORY_STRING_SECTION, key, NULL); 00175 g_free(key); 00176 00177 return filename; 00178 }
|
|
|
Get the type of a file history plugin.
Definition at line 377 of file gnc-plugin-file-history.c. 00378 { 00379 static GType gnc_plugin_file_history_type = 0; 00380 00381 if (gnc_plugin_file_history_type == 0) { 00382 static const GTypeInfo our_info = { 00383 sizeof (GncPluginFileHistoryClass), 00384 NULL, /* base_init */ 00385 NULL, /* base_finalize */ 00386 (GClassInitFunc) gnc_plugin_file_history_class_init, 00387 NULL, /* class_finalize */ 00388 NULL, /* class_data */ 00389 sizeof (GncPluginFileHistory), 00390 0, 00391 (GInstanceInitFunc) gnc_plugin_file_history_init 00392 }; 00393 00394 gnc_plugin_file_history_type = g_type_register_static (GNC_TYPE_PLUGIN, 00395 "GncPluginFileHistory", 00396 &our_info, 0); 00397 } 00398 00399 return gnc_plugin_file_history_type; 00400 }
|
|
|
Create a new file history plugin. This plugin attaches the file history menu to any window that is opened.
Definition at line 459 of file gnc-plugin-file-history.c. 00460 { 00461 GncPlugin *plugin_page = NULL; 00462 00463 ENTER(""); 00464 plugin_page = GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_FILE_HISTORY, NULL)); 00465 LEAVE("plugin %p", plugin_page); 00466 return plugin_page; 00467 }
|
1.4.3-20050530