Mailinglist Archive: yast-commit (1809 mails)

< Previous Next >
[yast-commit] r58511 - in /trunk/gtk: ChangeLog src/YGPackageSelector.cc src/ygtkwizard.c src/ygtkzyppview.cc src/ygtkzyppview.h src/yzyppwrapper.cc src/yzyppwrapper.h
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Thu, 03 Sep 2009 18:00:02 -0000
  • Message-id: <E1MjGbK-0004pl-5V@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Thu Sep 3 20:00:01 2009
New Revision: 58511

URL: http://svn.opensuse.org/viewcvs/yast?rev=58511&view=rev
Log:
* src/icons/pkg-tiles-mode.xpm & pkg-list-mode.xpm:
removed.

* src/YGPackageSelector.cc: when exact package found,
highlight respective tab.

* src/YGPackageSelector.cc: replaced the undo tab by the
confirmation dialog widgetry.

* src/ygtkwizard.c: enlarged help window.

* src/ygtkzyppview.h/cc: switched remove tab default toggles.

* src/yzyppwrapper.h/cc: added whole_string option to
PkgQuery::Query.

* src/ygtkzyppview.h/cc: re-aligned description and version
control boxes.

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/ygtkwizard.c
trunk/gtk/src/ygtkzyppview.cc
trunk/gtk/src/ygtkzyppview.h
trunk/gtk/src/yzyppwrapper.cc
trunk/gtk/src/yzyppwrapper.h

Modified: trunk/gtk/ChangeLog
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=58511&r1=58510&r2=58511&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Thu Sep 3 20:00:01 2009
@@ -3,6 +3,22 @@
* src/icons/pkg-tiles-mode.xpm & pkg-list-mode.xpm:
removed.

+ * src/YGPackageSelector.cc: when exact package found,
+ highlight respective tab.
+
+ * src/YGPackageSelector.cc: replaced the undo tab by the
+ confirmation dialog widgetry.
+
+ * src/ygtkwizard.c: enlarged help window.
+
+ * src/ygtkzyppview.h/cc: switched remove tab default toggles.
+
+ * src/yzyppwrapper.h/cc: added whole_string option to
+ PkgQuery::Query.
+
+ * src/ygtkzyppview.h/cc: re-aligned description and version
+ control boxes.
+
2009-09-02 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>

* src/ygtktreemodel.h/cc: nice wrapper for GtkTreeModel.

Modified: trunk/gtk/src/YGPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=58511&r1=58510&r2=58511&view=diff
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Thu Sep 3 20:00:01 2009
@@ -536,7 +536,10 @@
"(usage example: \"yast dhcp\" will return yast's dhcpd
tool)"));
g_signal_connect (G_OBJECT (m_name), "changed",
G_CALLBACK (name_changed_cb), this);
- button = gtk_button_new_with_mnemonic (_("_Search"));
+ button = gtk_button_new_with_label ("");
+ GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_OK,
GTK_ICON_SIZE_MENU);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_widget_set_tooltip_text (button, _("Search!"));
gtk_box_pack_start (GTK_BOX (name_box), m_name, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (name_box), button, FALSE, TRUE, 0);

@@ -547,7 +550,7 @@
m_radio[1] = gtk_radio_button_new_with_label_from_widget
(radiob, _("Description"));
m_radio[2] = gtk_radio_button_new_with_label_from_widget
(radiob, _("File name"));
gtk_widget_set_tooltip_markup (m_radio[2],
- _("Only applicable to <b>installed</b> packages."));
+ _("Only applicable to installed packages."));
if (m_onlineUpdate)
m_radio[3] = NULL;
else
@@ -576,14 +579,21 @@
gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO,
GTK_ICON_SIZE_MENU), FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (m_info_box), m_info_label, TRUE,
TRUE, 0);

- GtkWidget *separator = gtk_event_box_new();
- gtk_widget_set_size_request (separator, -1, 50);
-
- m_box = gtk_vbox_new (FALSE, 12);
- gtk_box_pack_start (GTK_BOX (m_box), name_box, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_box), radio_frame, FALSE, TRUE,
0);
- gtk_box_pack_start (GTK_BOX (m_box), separator, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_box), m_info_box, FALSE, TRUE,
0);
+ GtkWidget *separator1 = gtk_event_box_new();
+ gtk_widget_set_size_request (separator1, -1, 12);
+ GtkWidget *separator2 = gtk_event_box_new();
+ gtk_widget_set_size_request (separator2, -1, 15);
+ GtkWidget *separator3 = gtk_event_box_new();
+ gtk_widget_set_size_request (separator3, -1, 50);
+
+ GtkWidget *box = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (box), separator1, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), name_box, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), separator2, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), radio_frame, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), separator3, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), m_info_box, FALSE, TRUE, 0);
+ m_box = box;

g_signal_connect (G_OBJECT (m_name), "activate", G_CALLBACK
(button_clicked_cb), this);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK
(button_clicked_cb), this);
@@ -640,7 +650,7 @@

int width;
gtk_icon_size_lookup
(GTK_ICON_SIZE_MENU, &width, NULL);
- width = m_box->allocation.width
- width - 6;
+ width =
getWidget()->allocation.width - width - 6;
gtk_widget_set_size_request
(m_info_label, width, -1);
gtk_widget_show_all
(m_info_box);
}
@@ -652,6 +662,15 @@
virtual bool installedPackagesOnly()
{ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m_radio[2]));
}

+ const char *searchName()
+ {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(m_radio[0]))) {
+ const char *name = gtk_entry_get_text (GTK_ENTRY
(m_name));
+ return *name ? name : NULL;
+ }
+ return NULL;
+ }
+
private:
static void novelty_toggled_cb (GtkToggleButton *button, FindBox *pThis)
{
@@ -679,7 +698,9 @@
}
ygtk_find_entry_set_state (entry, correct);
}
- if (*text == '\0') // user may have pressed brush icon thus
except search clear
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(pThis->m_radio[0])))
+ pThis->notifyDelay();
+ else if (*text == '\0')
pThis->notify();
}

@@ -711,6 +732,8 @@
gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo),
_("Languages"));
gtk_widget_set_tooltip_markup (m_combo,
_("Packages can be organized in:\n"
+ "<b>Search:</b> find a given package by name,
summary or some "
+ "other attribute.\n"
"<b>Groups:</b> simple categorization of
packages by purpose.\n"
"<b>Patterns:</b> assists in installing all
packages necessary "
"for several working environments.\n"
@@ -741,6 +764,13 @@
virtual bool installedPackagesOnly()
{ return m_queryWidget->installedPackagesOnly(); }

+ const char *searchName()
+ {
+ if (gtk_combo_box_get_active (GTK_COMBO_BOX (m_combo)) == 0)
+ return ((FindBox *) m_queryWidget)->searchName();
+ return NULL;
+ }
+
private:
void set (GtkWidget *widget)
{
@@ -852,6 +882,134 @@
{ pThis->setup(); }
};

+class UndoView
+{
+GtkWidget *m_vbox;
+Ypp::PkgList m_changes;
+
+public:
+ GtkWidget *getWidget() { return m_vbox; }
+
+ UndoView (PackagesView::Listener *listener)
+ {
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ query->setToModify (true);
+ m_changes = Ypp::PkgQuery (Ypp::Package::PACKAGE_TYPE, query);
+
+ GtkWidget *view = createView (m_changes, listener);
+
+ GtkWidget *uncouple_button = gtk_button_new_with_label
(_("Uncouple"));
+ GtkWidget *icon = gtk_image_new_from_stock
(GTK_STOCK_DISCONNECT, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (uncouple_button), icon);
+ GtkWidget *uncouple_align = gtk_alignment_new (1, .5, 0, 1);
+ gtk_container_add (GTK_CONTAINER (uncouple_align),
uncouple_button);
+ g_signal_connect (G_OBJECT (uncouple_button), "clicked",
+ G_CALLBACK (uncouple_clicked_cb), this);
+
+ m_vbox = gtk_vbox_new (FALSE, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (m_vbox), 6);
+ gtk_box_pack_start (GTK_BOX (m_vbox), view, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_vbox), uncouple_align, FALSE,
TRUE, 0);
+ gtk_widget_show_all (m_vbox);
+ g_object_ref_sink (m_vbox);
+ }
+
+ ~UndoView()
+ { g_object_unref (m_vbox); }
+
+private:
+ static GtkWidget *createView (const Ypp::PkgList changes,
PackagesView::Listener *listener)
+ {
+ GtkWidget *hbox = gtk_hbox_new (TRUE, 6);
+ for (int i = 0; i < 3; i++) {
+ const char *str = 0, *stock = 0;
+ Ypp::PkgQuery::Query *query = new
Ypp::PkgQuery::Query();
+ int checkCol = 0;
+ switch (i) {
+ case 0:
+ str = _("To install:");
+ stock = GTK_STOCK_ADD;
+ query->setToInstall (true);
+ query->setIsInstalled (false);
+ checkCol = ZyppModel::TO_INSTALL_COLUMN;
+ break;
+ case 1:
+ str = _("To upgrade:");
+ stock = GTK_STOCK_GO_UP;
+ query->setToInstall (true);
+ query->setIsInstalled (true);
+ checkCol = ZyppModel::TO_UPGRADE_COLUMN;
+ break;
+ case 2:
+ str = _("To remove:");
+ stock = GTK_STOCK_REMOVE;
+ query->setToRemove (true);
+ checkCol = ZyppModel::TO_REMOVE_COLUMN;
+ break;
+ default: break;
+ }
+ Ypp::PkgQuery list (changes, query);
+
+ GtkWidget *label_box, *icon, *label;
+ label = gtk_label_new (str);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
+ icon = gtk_image_new_from_stock (stock,
GTK_ICON_SIZE_MENU);
+ label_box = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (label_box), icon, FALSE,
TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (label_box), label, TRUE,
TRUE, 0);
+ PackagesView *view = new PackagesView (true);
+ view->appendCheckColumn (checkCol);
+ view->appendTextColumn (NULL, ZyppModel::NAME_COLUMN);
+ view->setRows (list, NULL);
+ view->setFrame (true);
+ view->setListener (listener);
+ // PackagesView is not a GtkWidget, we need to destroy
it:
+ g_object_set_data_full (G_OBJECT (label_box), "view",
view, delete_pkgview);
+
+ GtkWidget *box = gtk_vbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (box), label_box, FALSE,
TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (box), view->getWidget(),
TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), box, TRUE, TRUE, 0);
+ }
+ return hbox;
+ }
+
+ static void uncouple_clicked_cb (GtkButton *button, UndoView *pThis)
+ {
+ gtk_widget_hide (pThis->m_vbox);
+ GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Undo
History"),
+ YGDialog::currentWindow(),
GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_CLOSE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 450);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+ g_signal_connect (G_OBJECT (dialog), "delete-event",
+ G_CALLBACK (uncouple_delete_event_cb), pThis);
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (close_response_cb), pThis);
+
+ GtkWidget *view = createView (pThis->m_changes, NULL);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area
(GTK_DIALOG (dialog))), view);
+ gtk_widget_show_all (dialog);
+ }
+
+ static void delete_pkgview (gpointer data)
+ { delete (PackagesView *) data; }
+
+ static gboolean uncouple_delete_event_cb (
+ GtkWidget *widget, GdkEvent *event, UndoView *pThis)
+ {
+ gtk_widget_show (pThis->m_vbox);
+ return FALSE;
+ }
+
+ static void close_response_cb (GtkDialog *dialog, gint response,
UndoView *pThis)
+ {
+ gtk_widget_show (pThis->m_vbox);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ }
+};
+
class QueryNotebook : public QueryListener, PackagesView::Listener
{
GtkWidget *m_widget, *m_notebook;
@@ -861,30 +1019,37 @@
PackageDetails *m_details;
FlexPane *m_pane;
GtkWidget *m_oldPage;
+UndoView *m_undoView;
guint m_timeout_id;
-Ypp::PkgList m_changes;
+bool m_highlightTab;

public:
GtkWidget *getWidget() { return m_widget; }

QueryNotebook (bool onlineUpdate, bool repoMgrEnabled)
- : m_onlineUpdate (onlineUpdate), m_view (NULL), m_oldPage (NULL),
m_timeout_id (0)
+ : m_onlineUpdate (onlineUpdate), m_view (NULL), m_timeout_id (0),
m_highlightTab (false)
{
m_notebook = gtk_notebook_new();
- appendPage (m_notebook, _("_Install"), GTK_STOCK_ADD, 0);
+ appendPage (m_notebook, _("_Install"), GTK_STOCK_ADD, 0, NULL);
if (!onlineUpdate)
- appendPage (m_notebook, _("_Upgrade"), GTK_STOCK_GO_UP,
1);
- appendPage (m_notebook, _("_Remove"), GTK_STOCK_REMOVE, 2);
+ appendPage (m_notebook, _("_Upgrade"), GTK_STOCK_GO_UP,
1, NULL);
+ appendPage (m_notebook, _("_Remove"), GTK_STOCK_REMOVE, 2,
NULL);
if (!onlineUpdate) {
- appendPage (m_notebook, _("_Undo"), GTK_STOCK_UNDO, 3);
- Ypp::PkgQuery::Query *query = new
Ypp::PkgQuery::Query();
- query->setToModify (true);
- m_changes = Ypp::PkgQuery (Ypp::Package::PACKAGE_TYPE,
query);
+ m_undoView = new UndoView (this);
+ appendPage (m_notebook, _("_Undo"), GTK_STOCK_UNDO, 3,
m_undoView->getWidget());
}
gtk_widget_show (m_notebook);
g_signal_connect_after (G_OBJECT (m_notebook), "switch-page",
G_CALLBACK (switch_page_cb), this);

+#if 0 // test: put search entry as a new tab (since we can't make use of the
empty space...)
+ GtkWidget *entry = ygtk_find_entry_new();
+ gtk_widget_show (entry);
+ GtkWidget *page = gtk_event_box_new();
+ gtk_widget_show (page);
+ gtk_notebook_append_page (GTK_NOTEBOOK (m_notebook), page,
entry);
+#endif
+
m_details = new PackageDetails (onlineUpdate);
m_pane = new FlexPane();
m_pane->pack (m_notebook, true, false);
@@ -900,7 +1065,7 @@
m_widget = hpane;
gtk_widget_show_all (m_widget);
gtk_widget_hide (m_details->getWidget());
- preparePage (0);
+ m_oldPage = gtk_notebook_get_nth_page (GTK_NOTEBOOK
(m_notebook), 0);
queryNotify();
}

@@ -912,11 +1077,18 @@
delete m_combo;
delete m_details;
delete m_pane;
+ delete m_undoView;
+ }
+
+ void setUndoPage()
+ {
+ if (!m_onlineUpdate)
+ gtk_notebook_set_current_page (GTK_NOTEBOOK
(m_notebook), 3);
}

private:
- static void appendPage (GtkWidget *notebook, const char *text,
- const char *stock_icon, int nb)
+ static void appendPage (GtkWidget *notebook, const char *text, const
char *stock_icon,
+ int nb, GtkWidget *child)
{
GtkWidget *hbox = gtk_hbox_new (FALSE, 6), *label, *icon;
if (stock_icon) {
@@ -926,49 +1098,30 @@
label = gtk_label_new (text);
gtk_label_set_use_underline (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ g_object_set_data (G_OBJECT (hbox), "label", label);
gtk_widget_show_all (hbox);

- GtkWidget *page = gtk_event_box_new();
+ GtkWidget *page = child;
+ if (!page) page = gtk_event_box_new();
gtk_widget_show (page);
g_object_set_data (G_OBJECT (page), "nb", GINT_TO_POINTER (nb));

gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, hbox);
}

- void preparePage (int nb)
+ void clearPage()
{
- if (m_view)
- gtk_container_remove (GTK_CONTAINER (m_oldPage),
m_view->getWidget());
+ if (m_oldPage)
+ gtk_container_remove (GTK_CONTAINER (m_oldPage),
GTK_BIN (m_oldPage)->child);
delete m_view;
-
- int col;
- switch (selectedPage()) {
- default:
- case 0: col = ZyppModel::TO_INSTALL_COLUMN; break;
- case 1: col = ZyppModel::TO_UPGRADE_COLUMN; break;
- case 2: col = ZyppModel::NOT_TO_REMOVE_COLUMN; break;
- case 3: col = ZyppModel::TO_MODIFY_COLUMN; break;
- }
- m_view = new PackagesView (false);
- m_view->appendCheckColumn (col);
- int nameSize = (col == ZyppModel::TO_UPGRADE_COLUMN) ? -1 : 150;
- m_view->appendTextColumn (_("Name"), ZyppModel::NAME_COLUMN,
nameSize);
- if (col == ZyppModel::TO_UPGRADE_COLUMN) {
- m_view->appendTextColumn (_("Installed"),
ZyppModel::INSTALLED_VERSION_COLUMN, 150);
- m_view->appendTextColumn (_("Available"),
ZyppModel::AVAILABLE_VERSION_COLUMN, 150);
- }
- else
- m_view->appendTextColumn (_("Summary"),
ZyppModel::SUMMARY_COLUMN);
- m_view->setListener (this);
-
- m_oldPage = gtk_notebook_get_nth_page (GTK_NOTEBOOK
(m_notebook), nb);
- gtk_container_add (GTK_CONTAINER (m_oldPage),
m_view->getWidget());
+ m_view = NULL;
}

static void switch_page_cb (GtkNotebook *notebook, GtkNotebookPage *,
guint nb, QueryNotebook *pThis)
{
- pThis->preparePage (nb);
+ pThis->clearPage();
+ pThis->m_oldPage = gtk_notebook_get_nth_page (notebook, nb);
pThis->queryNotify();
}

@@ -979,10 +1132,37 @@
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (page),
"nb"));
}

+ Ypp::PkgQuery getQuery (int page)
+ {
+ Ypp::Package::Type type =
+ m_onlineUpdate ? Ypp::Package::PATCH_TYPE :
Ypp::Package::PACKAGE_TYPE;
+ Ypp::PkgList list (Ypp::get()->getPackages (type));
+
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ switch (page) {
+ case 0: // available
+ if (m_onlineUpdate)
+ // special pane for patches upgrades
makes little sense, so
+ // we instead list them together with
availables
+ query->setHasUpgrade (true);
+ query->setIsInstalled (false);
+ break;
+ case 1: // upgrades
+ query->setHasUpgrade (true);
+ break;
+ case 2: // installed
+ query->setIsInstalled (true);
+ break;
+ default: break;
+ }
+
+ m_combo->writeQuery (query);
+ return Ypp::PkgQuery (list, query);
+ }
+
virtual void queryNotify()
{
- // limit users to the tabs whose query is applicable
- {
+ { // limit users to the tabs whose query is applicable
GList *pages = gtk_container_get_children
(GTK_CONTAINER (m_notebook));
for (GList *i = pages; i; i = i->next) {
GtkWidget *label, *page = (GtkWidget *) i->data;
@@ -996,7 +1176,7 @@
}
if (m_combo->availablePackagesOnly()) {
int selected = gtk_notebook_get_current_page
(GTK_NOTEBOOK (m_notebook));
- if (selected > 0)
+ if (selected > 0 && selected < 3)
gtk_notebook_set_current_page (GTK_NOTEBOOK
(m_notebook), 0);

GList *pages = gtk_container_get_children
(GTK_CONTAINER (m_notebook));
@@ -1007,7 +1187,7 @@
gtk_widget_set_tooltip_text (label, _("Query
only applicable to available packages."));
}
g_list_free (pages);
- if (selected > 0)
+ if (selected > 0 && selected < 3)
return;
}
else if (m_combo->installedPackagesOnly()) {
@@ -1025,49 +1205,63 @@
return;
}

- // set query
- m_view->clear();
- Ypp::Package::Type type =
- m_onlineUpdate ? Ypp::Package::PATCH_TYPE :
Ypp::Package::PACKAGE_TYPE;
- Ypp::PkgList list (Ypp::get()->getPackages (type));
-
- Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
-
int page = selectedPage();
- switch (page) {
- case 0: // available
- if (m_onlineUpdate)
- // special pane for patches upgrades
makes little sense, so
- // we instead list them together with
availables
- query->setHasUpgrade (true);
- query->setIsInstalled (false);
- break;
- case 1: // upgrades
- query->setHasUpgrade (true);
- break;
- case 2: // installed
- query->setIsInstalled (true);
- break;
- case 3: // undo
- list = m_changes;
- break;
- default: break;
+ if (page == 3) {
+ gtk_container_add (GTK_CONTAINER (m_oldPage),
m_undoView->getWidget());
+ return;
}

- m_combo->writeQuery (query);
-
- if (page == 3) {
- query = new Ypp::PkgQuery::Query();
- query->setToInstall (true);
- m_view->appendRows (_("To install:"), Ypp::PkgQuery
(m_changes, query), NULL);
-
- query = new Ypp::PkgQuery::Query();
- query->setToRemove (true);;
- m_view->appendRows (_("To remove:"), Ypp::PkgQuery
(m_changes, query), NULL);
+ if (!m_view) {
+ int col;
+ switch (page) {
+ default:
+ case 0: col = ZyppModel::TO_INSTALL_COLUMN;
break;
+ case 1: col = ZyppModel::TO_UPGRADE_COLUMN;
break;
+ case 2: col = ZyppModel::TO_REMOVE_COLUMN;
break;
+ }
+ m_view = new PackagesView (false);
+ m_view->appendCheckColumn (col);
+ int nameSize = (col == ZyppModel::TO_UPGRADE_COLUMN) ?
-1 : 150;
+ m_view->appendTextColumn (_("Name"),
ZyppModel::NAME_COLUMN, nameSize);
+ if (col == ZyppModel::TO_UPGRADE_COLUMN) {
+ m_view->appendTextColumn (_("Installed"),
ZyppModel::INSTALLED_VERSION_COLUMN, 150);
+ m_view->appendTextColumn (_("Available"),
ZyppModel::AVAILABLE_VERSION_COLUMN, 150);
+ }
+ else
+ m_view->appendTextColumn (_("Summary"),
ZyppModel::SUMMARY_COLUMN);
+ m_view->setListener (this);
+ gtk_container_add (GTK_CONTAINER (m_oldPage),
m_view->getWidget());
}
- else {
- const char *applyAll = page == 1 ? _("Upgrade All") : 0;
- m_view->setRows (Ypp::PkgQuery (list, query), applyAll);
+
+ // set query
+ m_view->clear();
+ const char *applyAll = page == 1 ? _("Upgrade All") : 0;
+ m_view->setRows (getQuery (page), applyAll);
+
+ if (!m_onlineUpdate) {
+ // set tab label bold if there's a package there with
the name
+ if (m_highlightTab) {
+ for (int i = 0; i < 3; i++)
+ setTabLabelWeight (i,
PANGO_WEIGHT_NORMAL);
+ m_highlightTab = false;
+ }
+ const char *name = m_combo->searchName();
+ if (name) {
+ Ypp::PkgQuery::Query *query = new
Ypp::PkgQuery::Query();
+ query->addNames (name, 0, true, false, false,
false, false, true, true);
+ Ypp::PkgQuery list (Ypp::Package::PACKAGE_TYPE,
query);
+ if (list.size()) {
+ m_highlightTab = true;
+ Ypp::Package *pkg = list.get (0);
+ if (!pkg->isInstalled())
+ setTabLabelWeight (0,
PANGO_WEIGHT_BOLD);
+ else {
+ setTabLabelWeight (2,
PANGO_WEIGHT_BOLD);
+ if (pkg->hasUpgrade())
+ setTabLabelWeight (1,
PANGO_WEIGHT_BOLD);
+ }
+ }
+ }
}
}

@@ -1092,6 +1286,15 @@
if (packages.size() > 0)
gtk_widget_show (m_details->getWidget());
}
+
+ void setTabLabelWeight (int page, PangoWeight weight)
+ {
+ GtkNotebook *notebook = GTK_NOTEBOOK (m_notebook);
+ GtkWidget *label = gtk_notebook_get_tab_label (notebook,
+ gtk_notebook_get_nth_page (notebook, page));
+ label = (GtkWidget *) g_object_get_data (G_OBJECT (label),
"label");
+ YGUtils::setWidgetFont (label, PANGO_STYLE_NORMAL, weight,
PANGO_SCALE_MEDIUM);
+ }
};

class DiskView : public Ypp::Disk::Listener
@@ -1395,84 +1598,6 @@

//** Dialogs

-static bool confirmApply()
-{
- if (!Ypp::get()->isModified())
- return true;
-
- GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Confirm Changes"),
- YGDialog::currentWindow(), GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_NO, GTK_STOCK_APPLY,
GTK_RESPONSE_YES, NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
- gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 450);
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
-
- GtkWidget *vbox = gtk_vbox_new (FALSE, 6);
- gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area
(GTK_DIALOG (dialog))), vbox);
- GtkWidget *label = gtk_label_new (_("Please confirm changes:"));
- YGUtils::setWidgetFont (label, PANGO_STYLE_NORMAL, PANGO_WEIGHT_BOLD,
PANGO_SCALE_MEDIUM);
- gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-
- GtkWidget *hbox = gtk_hbox_new (TRUE, 6);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
- for (int i = 0; i < 3; i++) {
- const char *str, *stock;
- Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
- int checkCol;
- switch (i) {
- case 0:
- str = _("To install:");
- stock = GTK_STOCK_ADD;
- query->setToInstall (true);
- query->setIsInstalled (false);
- checkCol = ZyppModel::TO_INSTALL_COLUMN;
- break;
- case 1:
- str = _("To upgrade:");
- stock = GTK_STOCK_GO_UP;
- query->setToInstall (true);
- query->setIsInstalled (true);
- checkCol = ZyppModel::TO_UPGRADE_COLUMN;
- break;
- case 2:
- str = _("To remove:");
- stock = GTK_STOCK_REMOVE;
- query->setToRemove (true);
- checkCol = ZyppModel::NOT_TO_REMOVE_COLUMN;
- break;
- default: break;
- }
-
- Ypp::PkgQuery list (Ypp::Package::PACKAGE_TYPE, query);
- if (list.size() == 0)
- continue;
-
- GtkWidget *label_box, *icon, *label;
- label = gtk_label_new (str);
- gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
- icon = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_MENU);
- label_box = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (label_box), icon, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (label_box), label, TRUE, TRUE, 0);
- PackagesView *view = new PackagesView (true);
- view->appendCheckColumn (checkCol);
- view->appendTextColumn (NULL, ZyppModel::NAME_COLUMN);
- view->setRows (list, NULL);
- view->setFrame (true);
-
- GtkWidget *box = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (box), label_box, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (box), view->getWidget(), TRUE,
TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), box, TRUE, TRUE, 0);
- }
-
- gtk_widget_show_all (vbox);
- bool ok = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES;
- gtk_widget_destroy (dialog);
- return ok;
-}
-
static bool confirmExit()
{
if (!Ypp::get()->isModified())
@@ -1531,7 +1656,7 @@
return confirmPkgs (_("Unsupported Packages"), _("Please
realize that the following "
"software is either unsupported or requires an
additional customer contract "
"for support."), GTK_MESSAGE_WARNING, list,
- _("Support"), ZyppModel::SUPPORT_COLUMN);
+ _("Supportability"), ZyppModel::SUPPORT_COLUMN);
return true;
}

@@ -1790,6 +1915,16 @@
return FALSE;
}

+ static gboolean wizard_confirm_button_cb (gpointer data)
+ {
+ YGPackageSelector *pThis = (YGPackageSelector *) data;
+ pThis->m_button_timeout_id = 0;
+ YGtkWizard *wizard = YGTK_WIZARD (pThis->getWidget());
+ ygtk_wizard_set_button_label (wizard, wizard->next_button,
+ _("A_pply"),
GTK_STOCK_APPLY);
+ return FALSE;
+ }
+
static bool confirm_cb (void *pThis)
{ return confirmExit(); }

@@ -1804,8 +1939,15 @@
if (pThis->confirmUnsupported())
if (!askConfirmUnsupported())
return;
- if (!confirmApply())
+ if (Ypp::get()->isModified() &&
!pThis->m_button_timeout_id) {
+ pThis->m_notebook->setUndoPage();
+ YGtkWizard *wizard = YGTK_WIZARD
(pThis->getWidget());
+ ygtk_wizard_set_button_label (wizard,
wizard->next_button,
+
_("_Sure?"), GTK_STOCK_OK);
+ pThis->m_button_timeout_id =
+ g_timeout_add (10*1000,
wizard_confirm_button_cb, pThis);
return;
+ }
}
YGUI::ui()->sendEvent (new YMenuEvent ("accept"));
}

Modified: trunk/gtk/src/ygtkwizard.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=58511&r1=58510&r2=58511&view=diff
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Thu Sep 3 20:00:01 2009
@@ -66,7 +66,7 @@
GTK_WIDGET (dialog), GTK_STOCK_HELP, GTK_ICON_SIZE_MENU, NULL);
gtk_window_set_icon (GTK_WINDOW (dialog), icon);
g_object_unref (G_OBJECT (icon));
- gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 350);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 450);

// help text
dialog->help_box = gtk_scrolled_window_new (NULL, NULL);

Modified: trunk/gtk/src/ygtkzyppview.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppview.cc?rev=58511&r1=58510&r2=58511&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppview.cc (original)
+++ trunk/gtk/src/ygtkzyppview.cc Thu Sep 3 20:00:01 2009
@@ -94,7 +94,7 @@
return G_TYPE_STRING;
case ZyppModel::TO_INSTALL_COLUMN:
case ZyppModel::TO_UPGRADE_COLUMN:
- case ZyppModel::NOT_TO_REMOVE_COLUMN:
+ case ZyppModel::TO_REMOVE_COLUMN:
case ZyppModel::TO_MODIFY_COLUMN:
case ZyppModel::SENSITIVE_COLUMN:
case ZyppModel::CHECK_VISIBLE_COLUMN:
@@ -129,7 +129,7 @@
break;
case ZyppModel::TO_INSTALL_COLUMN:
case ZyppModel::TO_UPGRADE_COLUMN:
- case ZyppModel::NOT_TO_REMOVE_COLUMN:
+ case ZyppModel::TO_REMOVE_COLUMN:
case ZyppModel::TO_MODIFY_COLUMN:
g_value_set_boolean (value, FALSE);
break;
@@ -332,9 +332,22 @@
case ZyppModel::NAME_COLUMN:
g_value_set_string (value, g_strdup
(segment->applyAll.c_str()));
break;
- case ZyppModel::BACKGROUND_COLUMN:
+ case ZyppModel::BACKGROUND_COLUMN: {
+#if 0
+ case ZyppModel::FOREGROUND_COLUMN:
+ GtkStyle *style =
gtk_widget_get_default_style();
+ GdkColor *color = &style->bg
[GTK_STATE_SELECTED];
+ if (col == ZyppModel::FOREGROUND_COLUMN)
+ color = &style->fg
[GTK_STATE_NORMAL];
+ gchar *str = gdk_color_to_string
(color); // old: "lightblue"
+ g_value_set_string (value, str);
+#endif
g_value_set_string (value, g_strdup
("lightblue"));
break;
+ }
+ case ZyppModel::FOREGROUND_COLUMN:
+ g_value_set_string (value, g_strdup
("black"));
+ break;
default:
_getValueDefault (col, value);
break;
@@ -460,8 +473,8 @@
g_value_set_boolean (value,
version->cmp > 0);
break;
}
- case ZyppModel::NOT_TO_REMOVE_COLUMN:
- g_value_set_boolean (value,
!package->toRemove());
+ case ZyppModel::TO_REMOVE_COLUMN:
+ g_value_set_boolean (value,
package->toRemove());
break;
case ZyppModel::TO_MODIFY_COLUMN:
g_value_set_boolean (value,
package->toModify());
@@ -469,6 +482,13 @@
case ZyppModel::SENSITIVE_COLUMN:
g_value_set_boolean (value,
!package->isLocked());
break;
+ case ZyppModel::STYLE_COLUMN: {
+ PangoStyle style = PANGO_STYLE_NORMAL;
+ if (package->isAuto())
+ style = PANGO_STYLE_ITALIC;
+ g_value_set_int (value, style);
+ break;
+ }
case ZyppModel::WEIGHT_COLUMN: {
bool highlight = segment->list.highlight
(index);
int weight = highlight ? PANGO_WEIGHT_BOLD :
PANGO_WEIGHT_NORMAL;
@@ -857,7 +877,7 @@
case ZyppModel::TO_UPGRADE_COLUMN:
package->install (0);
break;
- case ZyppModel::NOT_TO_REMOVE_COLUMN:
+ case ZyppModel::TO_REMOVE_COLUMN:
package->remove();
break;
default: break;
@@ -930,8 +950,7 @@
view, x, y, &bx, &by);
gtk_tree_view_get_path_at_pos (
view, x, y, NULL, &column, NULL, NULL);
- int status_col =
- gtk_widget_get_default_direction() ==
GTK_TEXT_DIR_RTL ? 1 : 0;
+ int status_col = 0;
if (column == gtk_tree_view_get_column (view,
status_col)) {
if (package->toInstall()) {
if (package->isInstalled())
@@ -951,9 +970,11 @@
if (package->isAuto())
text += _("\n<i>status changed
by the dependency solver</i>");
}
- if (package->isLocked()) {
- if (!text.empty()) text += "\n";
- text += _("<i>locked: right-click to
unlock</i>");
+ else {
+ if (package->isLocked())
+ text = _("locked: right-click
to unlock");
+ else if (package->isAuto())
+ text = _("auto: automatically
selected due to dependencies");
}
}
else {
@@ -1320,23 +1341,19 @@
Impl (bool onlineUpdate)
{
m_versions = new Versions();
- GtkWidget *vbox;
- m_widget = createWhiteViewPort (&vbox);
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 2);
+ m_widget = createWhiteViewPort (hbox);

GtkWidget *versions_box = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (versions_box),
createIconWidget (&m_icon, &m_icon_frame), FALSE, TRUE,
0);
gtk_box_pack_start (GTK_BOX (versions_box),
m_versions->getWidget(), FALSE, TRUE, 0);

+ GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
m_description = ygtk_rich_text_new();
g_signal_connect (G_OBJECT (m_description), "link-clicked",
G_CALLBACK (link_pressed_cb), this);
-
- GtkWidget *description_box = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (description_box), m_description,
TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (description_box), versions_box,
FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), description_box, FALSE,
TRUE, 0);
-
+ gtk_box_pack_start (GTK_BOX (vbox), m_description, FALSE, TRUE,
0);
if (!onlineUpdate) {
m_filelist = ygtk_rich_text_new();
m_changelog = ygtk_rich_text_new();
@@ -1365,7 +1382,10 @@
m_contents->appendTextColumn (_("Summary"),
ZyppModel::SUMMARY_COLUMN);
appendExpander (vbox, _("Applies to"),
m_contents->getWidget());
}
- gtk_widget_show_all (vbox);
+
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), versions_box, FALSE, TRUE,
0);
+ gtk_widget_show_all (hbox);
}

~Impl()
@@ -1387,7 +1407,7 @@
if (m_authors) setText (m_authors, package->authors
(true));
if (m_support) {
GtkWidget *expander = gtk_widget_get_ancestor
(m_support, GTK_TYPE_EXPANDER);
- std::string label ("<b>" + std::string
(_("Support:")) + "</b> ");
+ std::string label ("<b>" + std::string
(_("Supportability:")) + "</b> ");
label += package->support();
gtk_expander_set_label (GTK_EXPANDER
(expander), label.c_str());
setText (m_support, package->supportText
(true));
@@ -1483,7 +1503,7 @@
*icon_frame = align;
return align;
}
- static GtkWidget *createWhiteViewPort (GtkWidget **vbox)
+ static GtkWidget *createWhiteViewPort (GtkWidget *box)
{
struct inner {
static gboolean expose_cb (GtkWidget *widget,
GdkEventExpose *event)
@@ -1499,14 +1519,12 @@
}
};

- *vbox = gtk_vbox_new (FALSE, 0);
- g_signal_connect (G_OBJECT (*vbox), "expose-event",
+ g_signal_connect (G_OBJECT (box), "expose-event",
G_CALLBACK (inner::expose_cb), NULL);
-
GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW
(scroll), *vbox);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW
(scroll), box);
return scroll;
}
static void appendExpander (GtkWidget *box, const char *label,
GtkWidget *child)

Modified: trunk/gtk/src/ygtkzyppview.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppview.h?rev=58511&r1=58510&r2=58511&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppview.h (original)
+++ trunk/gtk/src/ygtkzyppview.h Thu Sep 3 20:00:01 2009
@@ -18,7 +18,7 @@
NAME_COLUMN, SUMMARY_COLUMN, NAME_SUMMARY_COLUMN,
REPOSITORY_COLUMN, SUPPORT_COLUMN,
INSTALLED_VERSION_COLUMN, AVAILABLE_VERSION_COLUMN,
// checks
- TO_INSTALL_COLUMN, TO_UPGRADE_COLUMN, NOT_TO_REMOVE_COLUMN,
TO_MODIFY_COLUMN,
+ TO_INSTALL_COLUMN, TO_UPGRADE_COLUMN, TO_REMOVE_COLUMN,
TO_MODIFY_COLUMN,
// internal
STYLE_COLUMN, WEIGHT_COLUMN, SENSITIVE_COLUMN,
CHECK_VISIBLE_COLUMN,
FOREGROUND_COLUMN, BACKGROUND_COLUMN,

Modified: trunk/gtk/src/yzyppwrapper.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=58511&r1=58510&r2=58511&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.cc (original)
+++ trunk/gtk/src/yzyppwrapper.cc Thu Sep 3 20:00:01 2009
@@ -480,6 +480,7 @@
ZyppObject object = m_sel->theObj();
std::string text = object->description(), br = "<br>";
if (markup == GTK_MARKUP && type == Ypp::Package::PACKAGE_TYPE)
{
+ YGUtils::escapeMarkup (text);
text += "\n";
const Ypp::Package::Version *version;
version = getInstalledVersion();
@@ -1747,8 +1748,8 @@
};

Keys <std::string> names;
- int use_name : 1, use_summary : 1, use_description : 1, use_filelist :
1,
- use_authors : 1, full_word_match : 1;
+ unsigned int use_name : 1, use_summary : 1, use_description : 1,
use_filelist : 1,
+ use_authors : 1, whole_word : 1, whole_string : 1;
Keys <Node *> categories, categories2;
Keys <const Package *> collections;
Keys <const Repository *> repositories;
@@ -1771,14 +1772,21 @@
{
struct inner {
static bool strstr (const char *str1, const char *str2,
- bool case_sensitive, bool
full_word_match)
+ bool case_sensitive, bool
whole_word, bool whole_string)
{
const char *i;
+ if (whole_string) {
+ if (case_sensitive)
+ return strcmp (str1, str2) == 0;
+if (strcasecmp (str1, str2) == 0)
+ fprintf (stderr, "whole string: '%s' vs '%s'\n", str1, str2);
+ return strcasecmp (str1, str2) == 0;
+ }
if (case_sensitive)
i = ::strstr (str1, str2);
else
i = ::strcasestr (str1, str2);
- if (full_word_match && i) { // check boundries
+ if (whole_word && i) { // check boundries
if (i != str1 && isalpha (i[-1]))
return false;
int len = strlen (str2);
@@ -1827,19 +1835,19 @@
bool str_match = false;
if (use_name)
str_match = inner::strstr
(package->name().c_str(), key,
- false,
full_word_match);
+ false,
whole_word, whole_string);
if (!str_match && use_summary)
str_match = inner::strstr
(package->summary().c_str(), key,
- false,
full_word_match);
+ false,
whole_word, whole_string);
if (!str_match && use_description)
str_match = inner::strstr
(package->description (NO_MARKUP).c_str(), key,
- false,
full_word_match);
+ false,
whole_word, whole_string);
if (!str_match && use_filelist)
str_match = inner::strstr
(package->filelist (false).c_str(), key,
- false,
full_word_match);
+ false,
whole_word, whole_string);
if (!str_match && use_authors)
str_match = inner::strstr
(package->authors (false).c_str(), key,
- false,
full_word_match);
+ false,
whole_word, whole_string);
if (!str_match) {
match = false;
break;
@@ -1914,7 +1922,7 @@

void Ypp::PkgQuery::Query::addNames (std::string value, char separator, bool
use_name,
bool use_summary, bool use_description, bool use_filelist, bool
use_authors,
- bool full_word_match)
+ bool whole_word, bool whole_string)
{
if (separator) {
const gchar delimiter[2] = { separator, '\0' };
@@ -1930,7 +1938,8 @@
impl->use_description = use_description;
impl->use_filelist = use_filelist;
impl->use_authors = use_authors;
- impl->full_word_match = full_word_match;
+ impl->whole_word = whole_word;
+ impl->whole_string = whole_string;
}
void Ypp::PkgQuery::Query::addCategory (Ypp::Node *value)
{ impl->categories.add (value); }

Modified: trunk/gtk/src/yzyppwrapper.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.h?rev=58511&r1=58510&r2=58511&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.h (original)
+++ trunk/gtk/src/yzyppwrapper.h Thu Sep 3 20:00:01 2009
@@ -176,7 +176,7 @@
void addNames (std::string name, char separator = 0,
bool use_name = true,
bool use_summary = true, bool use_description =
false,
bool use_filelist = false, bool use_authors =
false,
- bool full_word_match = false);
+ bool whole_word = false, bool whole_string =
false);
void addCategory (Ypp::Node *category);
void addCategory2 (Ypp::Node *category);
void addCollection (const Ypp::Package *package);

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages