ocarina: Update library path button

One click and the single library path will be updated
This commit is contained in:
Bryan Schumaker 2011-10-20 20:31:35 -04:00
parent 4f26d9ee2d
commit 3ff17e907c
1 changed files with 25 additions and 0 deletions

View File

@ -15,6 +15,7 @@ struct PathInfo
{
GtkWidget *widget;
GtkWidget *remove;
GtkWidget *update;
string path;
};
@ -37,6 +38,18 @@ static void on_click_update(GtkWidget *b, GdkEvent *e, gpointer d)
libsaria::library::update();
}
static void on_click_update_path(GtkWidget *b, GdkEvent *e, gpointer d)
{
list<PathInfo>::iterator it;
for (it = path_widgets.begin(); it != path_widgets.end(); it++) {
if ((*it).update == b) {
libsaria::library::update_path((*it).path);
break;
}
}
}
static void on_click_remove(GtkWidget *b, GdkEvent *e, gpointer d)
{
list<PathInfo>::iterator it;
@ -64,6 +77,15 @@ static GtkWidget *make_update_button()
true);
}
static GtkWidget *make_update_path_button()
{
return make_text_button(GTK_STOCK_REFRESH,
"Update Path",
on_click_update_path,
true);
}
static GtkWidget *make_remove_button()
{
return make_text_button(GTK_STOCK_REMOVE,
@ -101,9 +123,12 @@ static GtkWidget *add_buttons(GtkWidget *info_box, struct PathInfo &path)
{
GtkWidget *button_box = gtk_hbox_new(FALSE, 0);
GtkWidget *remove_btn = make_remove_button();
GtkWidget *update_btn = make_update_path_button();
path.remove = remove_btn;
path.update = update_btn;
box_pack_start(button_box, info_box, TRUE, TRUE, 0);
box_pack_start(button_box, update_btn, FALSE, FALSE, 0);
box_pack_start(button_box, remove_btn, FALSE, FALSE, 0);
return button_box;
}