Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable search dialog #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,27 +207,32 @@ set_current_view (view *v)
if (v->id == MAIN_VIEW)
{
enable_refresh (false);
enable_search (false);
prevent_updating ();
}
else if (v->id == UNINSTALL_APPLICATIONS_VIEW)
{
enable_refresh (false);
enable_search (true);
allow_updating ();
}
else if (v->id == INSTALL_SECTION_VIEW
|| v->id == SEARCH_RESULTS_VIEW)
{
enable_refresh (true);
enable_search (true);
allow_updating ();
}
else if (v->id == INSTALL_APPLICATIONS_VIEW)
{
enable_refresh (true);
enable_search (true);
allow_updating ();
}
else if (v->id == UPGRADE_APPLICATIONS_VIEW)
{
enable_refresh (true);
enable_search (true);
allow_updating ();
}

Expand Down
15 changes: 13 additions & 2 deletions src/menu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "log.h"
#include "settings.h"
#include "repo.h"
#include "search.h"
#include "apt-worker-client.h"
#include "user_files.h"

Expand All @@ -56,6 +57,7 @@ add_item (HildonAppMenu *menu, const gchar *label, void (*func)())
static GtkWidget *settings_menu_item = NULL;
static GtkWidget *install_from_file_menu_item = NULL;
static GtkWidget *refresh_menu_item = NULL;
static GtkWidget *search_menu_item = NULL;

void
set_settings_menu_visible (bool flag)
Expand Down Expand Up @@ -130,7 +132,11 @@ create_menu ()
add_item (main,
_("ai_me_settings"),
show_settings_dialog_flow);

/* Search */
search_menu_item =
add_item(main,
_("ai_me_search"),
show_search_dialog_flow);
gtk_widget_show_all (GTK_WIDGET (main));

/* Hide restore_packages menu item when there is no backup */
Expand All @@ -150,7 +156,12 @@ enable_refresh (bool flag)
if (refresh_menu_item)
g_object_set (G_OBJECT (refresh_menu_item), "visible", flag, NULL);
}

void
enable_search (bool flag)
{
if(search_menu_item)
g_object_set(G_OBJECT (search_menu_item), "visible", flag, NULL);
}
#if defined (TAP_AND_HOLD) && defined (MAEMO_CHANGES)
GtkWidget *
create_package_menu (const char *op_label)
Expand Down