Remember filter after closing edit window
* src/eom-main-window.c (eom_main_window_new): Set the `state' variable to 0 the first time around. (eom_main_window_load): Remove the `manga' parameter. Get incomplete collections when `state' is `0'. (eom_main_window_on_filter): Don't fetch any manga, just set the window's `state'. (eom_main_window_on_new): (eom_main_window_on_edit_closed): No more `manga' parameter for `eom_main_window_load'. * src/eom-main-window.h (struct _EomMainWindow): Add `state' property. * src/interface.c (interface_show_main_window): No more `manga' parameter for `eom_main_window_load'.
This commit is contained in:
parent
3dadedcd16
commit
8e49f0c56e
3 changed files with 14 additions and 16 deletions
|
@ -42,18 +42,20 @@ static void eom_main_window_on_row_activated(GtkWidget *treeview,
|
||||||
|
|
||||||
GtkWidget *eom_main_window_new(void)
|
GtkWidget *eom_main_window_new(void)
|
||||||
{
|
{
|
||||||
return g_object_new(EOM_TYPE_MAIN_WINDOW, NULL);
|
return g_object_new(EOM_TYPE_MAIN_WINDOW,
|
||||||
|
"state", 0,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void eom_main_window_load(EomMainWindow *self, GList *manga)
|
void eom_main_window_load(EomMainWindow *self)
|
||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
gtk_list_store_clear(self->store);
|
gtk_list_store_clear(self->store);
|
||||||
|
|
||||||
if (manga)
|
if (self->state)
|
||||||
list = manga;
|
list = data_get_incomplete_manga();
|
||||||
else
|
else
|
||||||
list = data_get_manga();
|
list = data_get_manga();
|
||||||
|
|
||||||
|
@ -216,14 +218,8 @@ static void eom_main_window_add_menu(EomMainWindow *window)
|
||||||
|
|
||||||
static void eom_main_window_on_filter(GtkWidget *widget, struct filter_args *arg)
|
static void eom_main_window_on_filter(GtkWidget *widget, struct filter_args *arg)
|
||||||
{
|
{
|
||||||
GList *manga;
|
arg->window->state = arg->state;
|
||||||
|
eom_main_window_load(arg->window);
|
||||||
if (arg->state)
|
|
||||||
manga = data_get_incomplete_manga();
|
|
||||||
else
|
|
||||||
manga = data_get_manga();
|
|
||||||
|
|
||||||
eom_main_window_load(arg->window, manga);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eom_main_window_on_new(GtkWidget *widget, GtkWindow *window)
|
static void eom_main_window_on_new(GtkWidget *widget, GtkWindow *window)
|
||||||
|
@ -252,7 +248,7 @@ static void eom_main_window_on_new(GtkWidget *widget, GtkWindow *window)
|
||||||
|
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
if (data_add_manga(name, total_qty))
|
if (data_add_manga(name, total_qty))
|
||||||
eom_main_window_load(EOM_MAIN_WINDOW(window), NULL);
|
eom_main_window_load(EOM_MAIN_WINDOW(window));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +258,7 @@ static gboolean eom_main_window_on_edit_closed(GtkWidget *widget,
|
||||||
{
|
{
|
||||||
EomMainWindow *self = user_data;
|
EomMainWindow *self = user_data;
|
||||||
|
|
||||||
eom_main_window_load(self, NULL);
|
eom_main_window_load(self);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,13 +45,15 @@ struct _EomMainWindow
|
||||||
|
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
|
|
||||||
|
int state;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType eom_main_window_get_type(void);
|
GType eom_main_window_get_type(void);
|
||||||
|
|
||||||
GtkWidget *eom_main_window_new(void);
|
GtkWidget *eom_main_window_new(void);
|
||||||
|
|
||||||
void eom_main_window_load(EomMainWindow *self, GList *manga);
|
void eom_main_window_load(EomMainWindow *self);
|
||||||
void eom_main_window_add_line(EomMainWindow *window,
|
void eom_main_window_add_line(EomMainWindow *window,
|
||||||
gint id,
|
gint id,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
|
|
|
@ -12,7 +12,7 @@ void interface_show_main_window(void)
|
||||||
window = eom_main_window_new();
|
window = eom_main_window_new();
|
||||||
gtk_widget_show_all(window);
|
gtk_widget_show_all(window);
|
||||||
|
|
||||||
eom_main_window_load(EOM_MAIN_WINDOW(window), NULL);
|
eom_main_window_load(EOM_MAIN_WINDOW(window));
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *interface_show_edit_window(gint manga_id)
|
GtkWidget *interface_show_edit_window(gint manga_id)
|
||||||
|
|
Loading…
Reference in a new issue