"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "restore_gui.c" between
jpilot-1.8.2.tar.gz and jpilot-2_0_1.tar.gz

About: J-Pilot is a desktop organizer application for Palm Pilot (PalmOS) devices. Ported to GTK3.

restore_gui.c  (jpilot-1.8.2):restore_gui.c  (jpilot-2_0_1)
skipping to change at line 42 skipping to change at line 42
#include "i18n.h" #include "i18n.h"
#include "utils.h" #include "utils.h"
#include "prefs.h" #include "prefs.h"
#include "sync.h" #include "sync.h"
#include "log.h" #include "log.h"
#include "restore.h" #include "restore.h"
/******************************* Global vars **********************************/ /******************************* Global vars **********************************/
static GtkWidget *user_entry; static GtkWidget *user_entry;
static GtkWidget *user_id_entry; static GtkWidget *user_id_entry;
static GtkWidget *restore_clist; static GtkWidget *restoreTreeView;
enum {
RESTORE_DISPLAY_COLUMN_ENUM = 0,
RESTORE_DATA_COLUMN_ENUM,
RESTORE_NUM_COLS
};
gboolean
checkForDuplication (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data);
/****************************** Main Code *************************************/ /****************************** Main Code *************************************/
static gboolean cb_restore_destroy(GtkWidget *widget) static gboolean cb_restore_destroy(GtkWidget *widget) {
{ gtk_main_quit();
gtk_main_quit();
return FALSE; return FALSE;
} }
static void cb_restore_ok(GtkWidget *widget, gpointer data) static void cb_restore_ok(GtkWidget *widget, gpointer data) {
{ GList *list, *temp_list;
GList *list, *temp_list;
char *text; char *text;
char file[FILENAME_MAX], backup_file[FILENAME_MAX]; char file[FILENAME_MAX], backup_file[FILENAME_MAX];
char home_dir[FILENAME_MAX]; char home_dir[FILENAME_MAX];
struct stat buf, backup_buf; struct stat buf, backup_buf;
int r1, r2; int r1, r2;
list=GTK_CLIST(restore_clist)->selection; GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(restoreTreeView)
);
get_home_file_name("", home_dir, sizeof(home_dir)); list = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(GTK_
TREE_VIEW(restoreTreeView)),&model);
/* Remove anything that was supposed to be installed */
g_snprintf(file, sizeof(file), "%s/"EPN".install", home_dir); get_home_file_name("", home_dir, sizeof(home_dir));
unlink(file);
/* Remove anything that was supposed to be installed */
jp_logf(JP_LOG_WARN, "%s%s%s\n", "-----===== ", _("Restore Handheld"), " ==== g_snprintf(file, sizeof(file), "%s/"EPN".install", home_dir);
==-----"); unlink(file);
for (temp_list=list; temp_list; temp_list = temp_list->next) {
gtk_clist_get_text(GTK_CLIST(restore_clist), GPOINTER_TO_INT(temp_list->da jp_logf(JP_LOG_WARN, "%s%s%s\n", "-----===== ", _("Restore Handheld"), " ===
ta), 0, &text); ===-----");
jp_logf(JP_LOG_DEBUG, "row %ld [%s]\n", (long) temp_list->data, text);
/* Look for the file in the JPILOT_HOME and JPILOT_HOME/backup. for (temp_list = list; temp_list; temp_list = temp_list->next) {
* Restore the newest modified date one, or the only one. */ GtkTreePath * path = temp_list->data;
g_snprintf(file, sizeof(file), "%s/%s", home_dir, text); GtkTreeIter iter;
g_snprintf(backup_file, sizeof(backup_file), "%s/backup/%s", home_dir, tex if(gtk_tree_model_get_iter(model,&iter,path)) {
t); gtk_tree_model_get(model, &iter, RESTORE_DISPLAY_COLUMN_ENUM, &text,
r1 = ! stat(file, &buf); -1);
r2 = ! stat(backup_file, &backup_buf); int * i = gtk_tree_path_get_indices ( path ) ;
if (r1 && r2) { jp_logf(JP_LOG_DEBUG, "row %ld [%s]\n", i[0], text);
/* found in JPILOT_HOME and JPILOT_HOME/backup */ /* Look for the file in the JPILOT_HOME and JPILOT_HOME/backup.
if (buf.st_mtime > backup_buf.st_mtime) { * Restore the newest modified date one, or the only one. */
jp_logf(JP_LOG_DEBUG, "Restore: found in home and backup, using home g_snprintf(file, sizeof(file), "%s/%s", home_dir, text);
file %s\n", text); g_snprintf(backup_file, sizeof(backup_file), "%s/backup/%s", home_di
install_append_line(file); r, text);
} else { r1 = !stat(file, &buf);
jp_logf(JP_LOG_DEBUG, "Restore: found in home and backup, using home r2 = !stat(backup_file, &backup_buf);
/backup file %s\n", text); if (r1 && r2) {
install_append_line(backup_file); /* found in JPILOT_HOME and JPILOT_HOME/backup */
} if (buf.st_mtime > backup_buf.st_mtime) {
} else if (r1) { jp_logf(JP_LOG_DEBUG, "Restore: found in home and backup, us
/* only found in JPILOT_HOME */ ing home file %s\n", text);
install_append_line(file); install_append_line(file);
jp_logf(JP_LOG_DEBUG, "Restore: using home file %s\n", text); } else {
} else if (r2) { jp_logf(JP_LOG_DEBUG, "Restore: found in home and backup, us
/* only found in JPILOT_HOME/backup */ ing home/backup file %s\n", text);
jp_logf(JP_LOG_DEBUG, "Restore: using home/backup file %s\n", text); install_append_line(backup_file);
install_append_line(backup_file); }
} } else if (r1) {
} /* only found in JPILOT_HOME */
install_append_line(file);
jp_logf(JP_LOG_DEBUG, "Restore: using home file %s\n", text);
} else if (r2) {
/* only found in JPILOT_HOME/backup */
jp_logf(JP_LOG_DEBUG, "Restore: using home/backup file %s\n", te
xt);
install_append_line(backup_file);
}
}
}
setup_sync(SYNC_NO_PLUGINS|SYNC_OVERRIDE_USER|SYNC_RESTORE); setup_sync(SYNC_NO_PLUGINS | SYNC_OVERRIDE_USER | SYNC_RESTORE);
gtk_widget_destroy(data); gtk_widget_destroy(data);
} }
static void cb_restore_quit(GtkWidget *widget, gpointer data) static void cb_restore_quit(GtkWidget *widget, gpointer data) {
{ gtk_widget_destroy(data);
gtk_widget_destroy(data);
} }
/* /*
* path is the dir to open * path is the dir to open
* check_for_dups will check the clist and not add if its a duplicate * check_for_dups will check the listStore and not add if its a duplicate
* check_exts will not add if its not a pdb, prc, or pqa. * check_exts will not add if its not a pdb, prc, or pqa.
*/ */
static int populate_clist_sub(char *path, int check_for_dups, int check_exts) static int populate_listStore_subpath(char *path, int check_for_dups, int check_
{ exts) {
char *row_text[1]; char *row_text[1];
DIR *dir; GtkListStore *listStore = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VI
struct dirent *dirent; EW(restoreTreeView)));
char last4[8]; GtkTreeIter iter;
char *text; DIR *dir;
int i, num, len, found; struct dirent *dirent;
char last4[8];
jp_logf(JP_LOG_DEBUG, "opening dir %s\n", path); int i, num, len, found;
dir = opendir(path);
num = 0; jp_logf(JP_LOG_DEBUG, "opening dir %s\n", path);
if (!dir) { dir = opendir(path);
jp_logf(JP_LOG_DEBUG, "opening dir failed\n"); num = 0;
} else { if (!dir) {
for (i=0; (dirent = readdir(dir)); i++) { jp_logf(JP_LOG_DEBUG, "opening dir failed\n");
if (i>1000) { } else {
jp_logf(JP_LOG_WARN, "populate_clist_sub(): %s\n", _("infinite loop" for (i = 0; (dirent = readdir(dir)); i++) {
)); if (i > 1000) {
closedir(dir); jp_logf(JP_LOG_WARN, "populate_listStore_subpath(): %s\n", _("in
return EXIT_FAILURE; finite loop"));
} closedir(dir);
if (dirent->d_name[0]=='.') { return EXIT_FAILURE;
continue; }
} if (dirent->d_name[0] == '.') {
if (!strncmp(dirent->d_name, "Unsaved Preferences", 17)) { continue;
jp_logf(JP_LOG_DEBUG, "skipping %s\n", dirent->d_name);
continue;
}
if (check_exts) {
len = strlen(dirent->d_name);
if (len < 4) {
continue;
} }
strncpy(last4, dirent->d_name+len-4, 4); if (!strncmp(dirent->d_name, "Unsaved Preferences", 17)) {
last4[4]='\0'; jp_logf(JP_LOG_DEBUG, "skipping %s\n", dirent->d_name);
if (strcmp(last4, ".pdb") && continue;
strcmp(last4, ".prc") &&
strcmp(last4, ".pqa")) {
continue;
} }
} if (check_exts) {
len = strlen(dirent->d_name);
if (len < 4) {
continue;
}
strncpy(last4, dirent->d_name + len - 4, 4);
last4[4] = '\0';
if (strcmp(last4, ".pdb") &&
strcmp(last4, ".prc") &&
strcmp(last4, ".pqa")) {
continue;
}
}
if (check_for_dups) {
found = 0;
RestoreDataSearchElement * element = malloc(sizeof(RestoreDataSe
archElement));;
element ->found = 0;
element ->textToSearch = dirent->d_name;
gtk_tree_model_foreach(GTK_TREE_MODEL(listStore), checkForDuplic
ation, element);
found = element -> found;
g_free(element);
if (found == 1)
continue;
if (check_for_dups) {
found=0;
for (i=0; i<GTK_CLIST(restore_clist)->rows; i++) {
gtk_clist_get_text(GTK_CLIST(restore_clist), i, 0, &text);
if (!(strcmp(dirent->d_name, text))) {
found=1;
break;
}
} }
if (found) continue;
}
row_text[0]=dirent->d_name; row_text[0] = dirent->d_name;
{ {
gchar *utf8_text; gchar *utf8_text;
utf8_text = g_locale_to_utf8(row_text[0], -1, NULL, NULL, NULL); utf8_text = g_locale_to_utf8(row_text[0], -1, NULL, NULL, NULL);
if (!utf8_text) { if (!utf8_text) {
jp_logf(JP_LOG_GUI, _("Unable to convert filename for GTK display jp_logf(JP_LOG_GUI, _("Unable to convert filename for GTK di
\n")); splay\n"));
jp_logf(JP_LOG_GUI, _("See console log to find which file will no jp_logf(JP_LOG_GUI, _("See console log to find which file wi
t be restored\n")); ll not be restored\n"));
jp_logf(JP_LOG_STDOUT|JP_LOG_FILE, _("Unable to convert filename jp_logf(JP_LOG_STDOUT | JP_LOG_FILE, _("Unable to convert fi
for GTK display\n")); lename for GTK display\n"));
jp_logf(JP_LOG_STDOUT|JP_LOG_FILE, _("File %s will not be restore jp_logf(JP_LOG_STDOUT | JP_LOG_FILE, _("File %s will not be
d\n"), row_text[0]); restored\n"), row_text[0]);
continue; continue;
}
row_text[0] = utf8_text;
gtk_list_store_append(listStore,&iter);
gtk_list_store_set(listStore,&iter,RESTORE_DISPLAY_COLUMN_ENUM,r
ow_text[0],-1);
g_free(utf8_text);
} }
row_text[0] = utf8_text; num++;
gtk_clist_append(GTK_CLIST(restore_clist), row_text); }
g_free(utf8_text); closedir(dir);
} }
num++;
}
closedir(dir);
}
gtk_clist_sort (GTK_CLIST (restore_clist)); return num;
return num;
} }
static int populate_clist(void) static int populate_listStore(void) {
{ char path[FILENAME_MAX];
char path[FILENAME_MAX];
get_home_file_name("backup", path, sizeof(path)); get_home_file_name("backup", path, sizeof(path));
cleanup_path(path); cleanup_path(path);
populate_clist_sub(path, 0, 0); populate_listStore_subpath(path, 0, 0);
get_home_file_name("", path, sizeof(path));
cleanup_path(path);
//populate_listStore_subpath(path, 1, 1);
populate_listStore_subpath(path, 1, 1);
gtk_tree_selection_select_all(gtk_tree_view_get_selection(GTK_TREE_VIEW(rest
oreTreeView)));
get_home_file_name("", path, sizeof(path)); return EXIT_SUCCESS;
cleanup_path(path); }
populate_clist_sub(path, 1, 1); gboolean
checkForDuplication (GtkTreeModel *model,
gtk_clist_select_all(GTK_CLIST(restore_clist)); GtkTreePath *path,
GtkTreeIter *iter,
gpointer data) {
char * rowText;
RestoreDataSearchElement *element = data;
gtk_tree_model_get(model,iter,RESTORE_DISPLAY_COLUMN_ENUM,&rowText,-1);
if (data != NULL) {
if ((strcmp(element->textToSearch, rowText))) {
element->found = 1;
return TRUE;
}
}
return FALSE;
return EXIT_SUCCESS;
} }
int restore_gui(GtkWidget *main_window, int w, int h, int x, int y) int restore_gui(GtkWidget *main_window, int w, int h, int x, int y) {
{ GtkWidget *restore_window;
GtkWidget *restore_window; GtkWidget *button;
GtkWidget *button; GtkWidget *vbox;
GtkWidget *vbox; GtkWidget *hbox;
GtkWidget *hbox; GtkWidget *scrolled_window;
GtkWidget *scrolled_window; GtkWidget *label;
GtkWidget *label; GtkListStore *listStore;
const char *svalue; const char *svalue;
long ivalue; long ivalue;
long char_set; long char_set;
char str_int[20]; char str_int[20];
jp_logf(JP_LOG_DEBUG, "restore_gui()\n"); jp_logf(JP_LOG_DEBUG, "restore_gui()\n");
restore_window = gtk_widget_new(GTK_TYPE_WINDOW, restore_window = gtk_widget_new(GTK_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL, "type", GTK_WINDOW_TOPLEVEL,
"title", _("Restore Handheld"), "title", _("Restore Handheld"),
NULL); NULL);
gtk_window_set_default_size(GTK_WINDOW(restore_window), w, h); gtk_window_set_default_size(GTK_WINDOW(restore_window), w, h);
gtk_widget_set_uposition(restore_window, x, y); //gtk_widget_set_uposition(restore_window, x, y);
gtk_container_set_border_width(GTK_CONTAINER(restore_window), 5); gtk_container_set_border_width(GTK_CONTAINER(restore_window), 5);
gtk_window_set_default_size(GTK_WINDOW(restore_window), w, h); gtk_window_set_default_size(GTK_WINDOW(restore_window), w, h);
gtk_window_set_modal(GTK_WINDOW(restore_window), TRUE); gtk_window_set_modal(GTK_WINDOW(restore_window), TRUE);
gtk_window_set_transient_for(GTK_WINDOW(restore_window), GTK_WINDOW(main_wind gtk_window_set_transient_for(GTK_WINDOW(restore_window), GTK_WINDOW(main_win
ow)); dow));
gtk_signal_connect(GTK_OBJECT(restore_window), "destroy", g_signal_connect(G_OBJECT(restore_window), "destroy",
GTK_SIGNAL_FUNC(cb_restore_destroy), restore_window); G_CALLBACK(cb_restore_destroy), restore_window);
vbox = gtk_vbox_new(FALSE, 0); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(restore_window), vbox); gtk_container_add(GTK_CONTAINER(restore_window), vbox);
/* Label for instructions */ /* Label for instructions */
label = gtk_label_new(_("To restore your handheld:")); label = gtk_label_new(_("To restore your handheld:"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_START);
label = gtk_label_new(_("1. Choose the applications you wish to restore. The gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
default is all.")); label = gtk_label_new(_("1. Choose the applications you wish to restore. Th
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); e default is all."));
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
label = gtk_label_new(_("2. Enter the User Name and User ID.")); gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); label = gtk_label_new(_("2. Enter the User Name and User ID."));
label = gtk_label_new(_("3. Press the OK button.")); gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
label = gtk_label_new(_("This will overwrite data that is currently on the ha label = gtk_label_new(_("3. Press the OK button."));
ndheld.")); gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
label = gtk_label_new(_("This will overwrite data that is currently on the h
/* List of files to restore */ andheld."));
scrolled_window = gtk_scrolled_window_new(NULL, NULL); gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 0); gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0); /* List of files to restore */
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
restore_clist = gtk_clist_new(1); gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 0);
gtk_clist_set_shadow_type(GTK_CLIST(restore_clist), SHADOW); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
gtk_clist_set_selection_mode(GTK_CLIST(restore_clist), GTK_SELECTION_EXTENDED GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
); gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
listStore = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
gtk_container_add(GTK_CONTAINER(scrolled_window), GTK_WIDGET(restore_clist)); restoreTreeView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(listStore));
GtkCellRenderer *textRenderer = gtk_cell_renderer_text_new();
/* User entry */ GtkTreeViewColumn *textColumn = gtk_tree_view_column_new_with_attributes("",
hbox = gtk_hbox_new(FALSE, 5); tex
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); tRenderer,
label = gtk_label_new(_("User Name")); "te
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); xt", RESTORE_DISPLAY_COLUMN_ENUM,
user_entry = gtk_entry_new_with_max_length(126); NUL
entry_set_multiline_truncate(GTK_ENTRY(user_entry), TRUE); L);
get_pref(PREF_USER, NULL, &svalue); gtk_tree_view_column_set_clickable(textColumn, gtk_false());
if ((svalue) && (svalue[0])) { gtk_tree_view_column_set_sizing(textColumn, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
/* Convert User Name stored in Palm character set */ gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(restor
char user_name[128]; eTreeView)),
GTK_SELECTION_MULTIPLE);
get_pref(PREF_CHAR_SET, &char_set, NULL); gtk_tree_view_insert_column(GTK_TREE_VIEW(restoreTreeView),textColumn,RESTOR
g_strlcpy(user_name, svalue, 128); E_DISPLAY_COLUMN_ENUM);
charset_p2j(user_name, 128, char_set); gtk_tree_view_column_set_sort_column_id(textColumn, RESTORE_DISPLAY_COLUMN_E
gtk_entry_set_text(GTK_ENTRY(user_entry), user_name); NUM);
} gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(restoreTreeView), gtk_false(
gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 0); ));
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(listStore), RESTORE_D
/* User ID entry */ ISPLAY_COLUMN_ENUM, GTK_SORT_ASCENDING);
hbox = gtk_hbox_new(FALSE, 5);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_container_add(GTK_CONTAINER(scrolled_window), GTK_WIDGET(restoreTreeView
label = gtk_label_new(_("User ID")); ));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); g_object_unref(listStore);
user_id_entry = gtk_entry_new_with_max_length(10); /* User entry */
entry_set_multiline_truncate(GTK_ENTRY(user_id_entry), TRUE); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
get_pref(PREF_USER_ID, &ivalue, NULL); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
sprintf(str_int, "%ld", ivalue); label = gtk_label_new(_("User Name"));
gtk_entry_set_text(GTK_ENTRY(user_id_entry), str_int); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), user_id_entry, TRUE, TRUE, 0); user_entry = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(user_entry), 126);
/* Cancel/OK buttons */ entry_set_multiline_truncate(GTK_ENTRY(user_entry), TRUE);
hbox = gtk_hbutton_box_new(); get_pref(PREF_USER, NULL, &svalue);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 12); if ((svalue) && (svalue[0])) {
gtk_button_box_set_layout(GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END); /* Convert User Name stored in Palm character set */
gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 6); char user_name[128];
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
get_pref(PREF_CHAR_SET, &char_set, NULL);
button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); g_strlcpy(user_name, svalue, 128);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); charset_p2j(user_name, 128, char_set);
gtk_signal_connect(GTK_OBJECT(button), "clicked", gtk_entry_set_text(GTK_ENTRY(user_entry), user_name);
GTK_SIGNAL_FUNC(cb_restore_quit), restore_window); }
gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 0);
button = gtk_button_new_from_stock(GTK_STOCK_OK);
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); /* User ID entry */
gtk_signal_connect(GTK_OBJECT(button), "clicked", hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
GTK_SIGNAL_FUNC(cb_restore_ok), restore_window); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new(_("User ID"));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
user_id_entry = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(user_id_entry), 10);
entry_set_multiline_truncate(GTK_ENTRY(user_id_entry), TRUE);
get_pref(PREF_USER_ID, &ivalue, NULL);
sprintf(str_int, "%ld", ivalue);
gtk_entry_set_text(GTK_ENTRY(user_id_entry), str_int);
gtk_box_pack_start(GTK_BOX(hbox), user_id_entry, TRUE, TRUE, 0);
/* Cancel/OK buttons */
hbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 12);
gtk_button_box_set_layout(GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END);
gtk_box_set_spacing(GTK_BOX(hbox), 6);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
button = gtk_button_new_with_label("Cancel");
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(cb_restore_quit), restore_window);
button = gtk_button_new_with_label("OK");
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(cb_restore_ok), restore_window);
populate_clist(); populate_listStore();
gtk_widget_show_all(restore_window); gtk_widget_show_all(restore_window);
gtk_main(); gtk_main();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
 End of changes. 25 change blocks. 
267 lines changed or deleted 336 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)