YaST Commits
Threads by month
- ----- 2024 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
December 2009
- 24 participants
- 488 discussions
[yast-commit] r60202 - in /trunk/gtk/src: pkg/YGPackageSelector.cc pkg/yzyppwrapper.cc pkg/yzyppwrapper.h ygtkfindentry.c ygtkwizard.c
by rpmcruz@svn.opensuse.org 28 Dec '09
by rpmcruz@svn.opensuse.org 28 Dec '09
28 Dec '09
Author: rpmcruz
Date: Mon Dec 28 19:16:58 2009
New Revision: 60202
URL: http://svn.opensuse.org/viewcvs/yast?rev=60202&view=rev
Log:
Remove printfs.
Modified:
trunk/gtk/src/pkg/YGPackageSelector.cc
trunk/gtk/src/pkg/yzyppwrapper.cc
trunk/gtk/src/pkg/yzyppwrapper.h
trunk/gtk/src/ygtkfindentry.c
trunk/gtk/src/ygtkwizard.c
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc…
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Mon Dec 28 19:16:58 2009
@@ -2553,7 +2553,7 @@
std::string label;
if (getuid() == 0) {
const char *username = getenv ("USERNAME");
- if (!username || !*username)
+ if (!username || !(*username))
username = "root";
label = _("_Open (as ");
label += username;
@@ -2589,7 +2589,7 @@
const char *username = 0;
if (getuid() == 0) {
username = getenv ("USERNAME");
- if (!*username)
+ if (username && !(*username))
username = 0;
}
Modified: trunk/gtk/src/pkg/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.cc?rev=…
==============================================================================
--- trunk/gtk/src/pkg/yzyppwrapper.cc (original)
+++ trunk/gtk/src/pkg/yzyppwrapper.cc Mon Dec 28 19:16:58 2009
@@ -615,7 +615,7 @@
#endif
std::string url = package->url(), license = package->license();
if (!url.empty())
- text += br + "<b>" + _("Website:") + "</b> <a href=\"" + url + "\">" + url + "</a>";
+ text += br + "<b>" + _("Web site:") + "</b> <a href=\"" + url + "\">" + url + "</a>";
if (!license.empty())
text += br + "<b>" + _("License:") + "</b> " + license;
#if 0
Modified: trunk/gtk/src/pkg/yzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.h?rev=6…
==============================================================================
--- trunk/gtk/src/pkg/yzyppwrapper.h (original)
+++ trunk/gtk/src/pkg/yzyppwrapper.h Mon Dec 28 19:16:58 2009
@@ -177,7 +177,6 @@
virtual ~PkgList();
};
-#if 1
// listing of packages as filtered
struct PkgQuery : public PkgList {
struct Query {
@@ -213,7 +212,6 @@
struct Impl;
Impl *impl;
};
-#endif
struct PkgSort : public PkgList {
PkgSort (PkgList list, const std::string &prop, bool ascending);
Modified: trunk/gtk/src/ygtkfindentry.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfindentry.c?rev=6020…
==============================================================================
--- trunk/gtk/src/ygtkfindentry.c (original)
+++ trunk/gtk/src/ygtkfindentry.c Mon Dec 28 19:16:58 2009
@@ -30,7 +30,6 @@
static void ygtk_ext_entry_map (GtkWidget *widget)
{
-fprintf (stderr, "ext entry - map\n");
if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget)) {
GTK_WIDGET_CLASS (ygtk_ext_entry_parent_class)->map (widget);
YGtkExtEntry *entry = YGTK_EXT_ENTRY (widget);
@@ -43,7 +42,6 @@
static void ygtk_ext_entry_unmap (GtkWidget *widget)
{
-fprintf (stderr, "ext entry - unmap\n");
if (GTK_WIDGET_MAPPED (widget)) {
YGtkExtEntry *entry = YGTK_EXT_ENTRY (widget);
if (entry->left_window)
@@ -330,7 +328,6 @@
static void ygtk_find_entry_realize (GtkWidget *widget)
{
-fprintf (stderr, "find entry - realize\n");
GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->realize (widget);
YGtkExtEntry *eentry = YGTK_EXT_ENTRY (widget);
@@ -351,7 +348,6 @@
static void ygtk_find_entry_unrealize (GtkWidget *widget)
{
-fprintf (stderr, "find entry - unrealize\n");
GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->unrealize (widget);
YGtkFindEntry *fentry = YGTK_FIND_ENTRY (widget);
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=60202&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Mon Dec 28 19:16:58 2009
@@ -141,7 +141,6 @@
// set close as default widget
gtk_widget_grab_default (dialog->close_button);
- gtk_widget_grab_focus (dialog->close_button);
}
static void ygtk_help_dialog_close (YGtkHelpDialog *dialog)
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r60201 - in /trunk/gtk/src/icons: pkg-list-mode.xpm pkg-tiles-mode.xpm
by rpmcruz@svn.opensuse.org 28 Dec '09
by rpmcruz@svn.opensuse.org 28 Dec '09
28 Dec '09
Author: rpmcruz
Date: Mon Dec 28 09:09:26 2009
New Revision: 60201
URL: http://svn.opensuse.org/viewcvs/yast?rev=60201&view=rev
Log:
No longer used icons.
Removed:
trunk/gtk/src/icons/pkg-list-mode.xpm
trunk/gtk/src/icons/pkg-tiles-mode.xpm
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r60200 - /trunk/gtk/src/pkg/YGPackageSelector.cc
by rpmcruz@svn.opensuse.org 28 Dec '09
by rpmcruz@svn.opensuse.org 28 Dec '09
28 Dec '09
Author: rpmcruz
Date: Mon Dec 28 09:08:41 2009
New Revision: 60200
URL: http://svn.opensuse.org/viewcvs/yast?rev=60200&view=rev
Log:
Cut padding.
Modified:
trunk/gtk/src/pkg/YGPackageSelector.cc
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc…
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Mon Dec 28 09:08:41 2009
@@ -2317,7 +2317,7 @@
gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), m_combo);
- m_widget = gtk_hbox_new (FALSE, 4);
+ m_widget = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (m_widget), label, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (m_widget), m_combo, TRUE, TRUE, 0);
g_signal_connect (G_OBJECT (m_combo), "changed",
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r60199 - in /trunk/gtk: ChangeLog src/YGPackageSelectorPluginStub.cc src/pkg/YGPackageSelector.cc src/pkg/yzyppwrapper.h
by rpmcruz@svn.opensuse.org 27 Dec '09
by rpmcruz@svn.opensuse.org 27 Dec '09
27 Dec '09
Author: rpmcruz
Date: Sun Dec 27 16:50:52 2009
New Revision: 60199
URL: http://svn.opensuse.org/viewcvs/yast?rev=60199&view=rev
Log:
* src/pkg/YGPackageSelector.cc: added --categories-top
flag.
* src/pkg/YGPackageSelector.cc: added context menu when
clicking on the website link.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGPackageSelectorPluginStub.cc
trunk/gtk/src/pkg/YGPackageSelector.cc
trunk/gtk/src/pkg/yzyppwrapper.h
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=60199&r1=60198…
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Sun Dec 27 16:50:52 2009
@@ -1,3 +1,11 @@
+2009-12-27 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
+
+ * src/pkg/YGPackageSelector.cc: added --categories-top
+ flag.
+
+ * src/pkg/YGPackageSelector.cc: added context menu when
+ clicking on the website link.
+
2009-12-25 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
* src/pkg/YGPackageSelector.cc: fixed crash when
Modified: trunk/gtk/src/YGPackageSelectorPluginStub.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelectorPluginS…
==============================================================================
--- trunk/gtk/src/YGPackageSelectorPluginStub.cc (original)
+++ trunk/gtk/src/YGPackageSelectorPluginStub.cc Sun Dec 27 16:50:52 2009
@@ -12,9 +12,9 @@
#include <string.h>
bool search_entry_side = true, search_entry_top = false, dynamic_sidebar = false,
- categories_side = true, status_side = false, status_tabs = true,
- status_tabs_as_actions = false, undo_side = false, undo_tab = true,
- undo_old_style = false, status_col = false, action_col = true,
+ categories_side = true, categories_top = false, status_side = false,
+ status_tabs = true, status_tabs_as_actions = false, undo_side = false,
+ undo_tab = true, undo_old_style = false, status_col = false, action_col = true,
action_col_as_button = true, action_col_as_check = false, version_col = true,
single_line_rows = false, details_start_hide = true, toolbar_top = false,
toolbar_yast = false, arrange_by = false;
@@ -28,6 +28,7 @@
{ "search-entry-top", &search_entry_top },
{ "dynamic-sidebar", &dynamic_sidebar },
{ "categories-side", &categories_side },
+ { "categories-top", &categories_top },
{ "status-side", &status_side },
{ "status-tabs", &status_tabs },
{ "status-tabs-as-actions", &status_tabs_as_actions },
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc…
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Sun Dec 27 16:50:52 2009
@@ -27,11 +27,11 @@
#include "ygtknotebook.h"
// experiments:
-extern bool search_entry_side, search_entry_top, dynamic_sidebar,
- categories_side, status_side, status_tabs, status_tabs_as_actions,
- undo_side, undo_tab, undo_old_style, status_col, action_col,
- action_col_as_button, action_col_as_check, version_col, single_line_rows,
- details_start_hide, toolbar_top, toolbar_yast, arrange_by;
+extern bool search_entry_side, search_entry_top, dynamic_sidebar, categories_side,
+ categories_top, status_side, status_tabs, status_tabs_as_actions, undo_side,
+ undo_tab, undo_old_style, status_col, action_col, action_col_as_button,
+ action_col_as_check, version_col, single_line_rows, details_start_hide,
+ toolbar_top, toolbar_yast, arrange_by;
//** UI components -- split up for re-usability, but mostly for readability
@@ -2082,7 +2082,9 @@
static void combo_changed_cb (GtkComboBox *combo, SearchEntry *pThis)
{
- pThis->notify();
+ const gchar *name = gtk_entry_get_text (GTK_ENTRY (pThis->m_entry));
+ if (*name) // if entry is not empty, no need to refresh query
+ pThis->notify();
gtk_widget_grab_focus (pThis->m_entry);
}
@@ -2137,17 +2139,104 @@
g_free (_text);
}
+class CategoryModel
+{
+GtkListStore *m_store;
+GtkTreeModel *m_filter;
+bool m_type2, m_dynamic;
+
+public:
+ CategoryModel (bool dynamic)
+ : m_type2 (false), m_dynamic (dynamic)
+ {
+ m_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_POINTER);
+ if (m_dynamic) {
+ m_filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (m_store), NULL);
+ gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (m_filter), 1);
+ g_object_unref (G_OBJECT (m_store));
+ }
+ }
+
+ ~CategoryModel()
+ { g_object_unref (G_OBJECT (getModel())); }
+
+ GtkTreeModel *getModel()
+ { return m_dynamic ? m_filter : GTK_TREE_MODEL (m_store); }
+
+ void setType (Ypp::Package::Type type)
+ {
+ m_type2 = (type == Ypp::Package::PACKAGE_TYPE);
+
+ gtk_list_store_clear (m_store);
+ GtkTreeIter iter;
+ gtk_list_store_append (m_store, &iter);
+ if (!m_dynamic)
+ gtk_list_store_set (m_store, &iter, 0, _("All packages"), -1);
+ gtk_list_store_set (m_store, &iter, 1, TRUE, 2, NULL, -1);
+ Ypp::Node *category;
+ if (m_type2)
+ category = Ypp::get()->getFirstCategory2 (type);
+ else
+ category = Ypp::get()->getFirstCategory (type);
+ for (; category; category = category->next()) {
+ gtk_list_store_append (m_store, &iter);
+ if (!m_dynamic)
+ gtk_list_store_set (m_store, &iter, 0, category->name.c_str(), -1);
+ gtk_list_store_set (m_store, &iter, 1, TRUE, 2, category, -1);
+ }
+ }
+
+ void updateList (Ypp::PkgList list)
+ {
+ if (!m_dynamic) return;
+ GtkTreeModel *model = GTK_TREE_MODEL (m_store);
+ GtkTreeIter iter;
+ if (gtk_tree_model_get_iter_first (model, &iter))
+ do {
+ Ypp::Node *category;
+ gtk_tree_model_get (model, &iter, 2, &category, -1);
+
+ if (category) {
+ int categoriesNb = 0;
+ for (int i = 0; i < list.size(); i++) {
+ Ypp::Package *pkg = list.get (i);
+ Ypp::Node *pkg_category = m_type2 ? pkg->category2() : pkg->category();
+ if (pkg_category == category)
+ categoriesNb++;
+ }
+ list_store_set_text_count (m_store, &iter, category->name.c_str(), categoriesNb);
+ }
+ else
+ list_store_set_text_count (m_store, &iter, _("All Categories"), list.size());
+ } while (gtk_tree_model_iter_next (model, &iter));
+ }
+
+ bool writeQuery (Ypp::PkgQuery::Query *query, GtkTreeIter *iter)
+ {
+ Ypp::Node *category;
+ gtk_tree_model_get (getModel(), iter, 2, &category, -1);
+ if (category) {
+ if (m_type2)
+ query->addCategory2 (category);
+ else
+ query->addCategory (category);
+ return true;
+ }
+ return false;
+ }
+};
+
class CategoryView : public _QueryWidget
{
GtkWidget *m_widget, *m_view;
-GtkTreeModel *m_model;
-bool m_type2;
+CategoryModel *m_model;
public:
CategoryView() : _QueryWidget()
{
- m_type2 = false;
+ m_model = new CategoryModel (dynamic_sidebar);
m_view = tree_view_new();
+ gtk_tree_view_set_model (GTK_TREE_VIEW (m_view), m_model->getModel());
GtkWidget *scroll = scrolled_window_new (m_view);
#if 0
GtkWidget *combo = gtk_combo_box_new_text();
@@ -2158,7 +2247,7 @@
G_CALLBACK (combo_changed_cb), this);
#endif
GtkWidget *combo = gtk_label_new_with_mnemonic ("Ca_tegories:");
- gtk_misc_set_alignment (GTK_MISC (combo), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (combo), 0, .5);
gtk_label_set_mnemonic_widget (GTK_LABEL (combo), m_view);
GtkWidget *vbox = gtk_vbox_new (FALSE, 4); //0);
@@ -2177,85 +2266,29 @@
virtual void updateType (Ypp::Package::Type type)
{
- m_type2 = type == Ypp::Package::PACKAGE_TYPE;
-
- GtkListStore *store;
- GtkTreeIter iter;
- store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_POINTER);
- m_model = GTK_TREE_MODEL (store);
- gtk_list_store_append (store, &iter);
- if (!dynamic_sidebar)
- gtk_list_store_set (store, &iter, 0, _("All packages"), -1);
- gtk_list_store_set (store, &iter, 1, TRUE, 2, NULL, -1);
- Ypp::Node *category;
- if (m_type2)
- category = Ypp::get()->getFirstCategory2 (type);
- else
- category = Ypp::get()->getFirstCategory (type);
- for (; category; category = category->next()) {
- gtk_list_store_append (store, &iter);
- if (!dynamic_sidebar)
- gtk_list_store_set (store, &iter, 0, category->name.c_str(), -1);
- gtk_list_store_set (store, &iter, 1, TRUE, 2, category, -1);
- }
- GtkTreeModel *filter_model = gtk_tree_model_filter_new (m_model, NULL);
- gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (filter_model), 1);
- gtk_tree_view_set_model (GTK_TREE_VIEW (m_view), filter_model);
- g_object_unref (G_OBJECT (store));
- g_object_unref (G_OBJECT (filter_model));
+ m_model->setType (type);
GtkTreeSelection *selection;
+ GtkTreeIter iter;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (m_view));
g_signal_handlers_block_by_func (selection, (gpointer) selection_changed_cb, this);
- gtk_tree_model_get_iter_first (filter_model, &iter);
+ gtk_tree_model_get_iter_first (m_model->getModel(), &iter);
gtk_tree_selection_select_iter (selection, &iter);
g_signal_handlers_unblock_by_func (selection, (gpointer) selection_changed_cb, this);
}
virtual void updateList (Ypp::PkgList list)
- {
- GtkTreeModel *model = GTK_TREE_MODEL (m_model);
- GtkTreeIter iter;
- if (gtk_tree_model_get_iter_first (model, &iter))
- do {
- Ypp::Node *category;
- gtk_tree_model_get (model, &iter, 2, &category, -1);
-
- GtkListStore *store = GTK_LIST_STORE (model);
- if (category) {
- int categoriesNb = 0;
- for (int i = 0; i < list.size(); i++) {
- Ypp::Package *pkg = list.get (i);
- Ypp::Node *pkg_category = m_type2 ? pkg->category2() : pkg->category();
- if (pkg_category == category)
- categoriesNb++;
- }
- list_store_set_text_count (store, &iter, category->name.c_str(), categoriesNb);
- }
- else
- list_store_set_text_count (store, &iter, _("All Categories"), list.size());
- } while (gtk_tree_model_iter_next (model, &iter));
- }
+ { m_model->updateList (list); }
virtual bool begsUpdate() { return dynamic_sidebar; }
virtual bool writeQuery (Ypp::PkgQuery::Query *query)
{
- GtkTreeModel *model;
GtkTreeIter iter;
GtkTreeSelection *selection;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (m_view));
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- Ypp::Node *category;
- gtk_tree_model_get (model, &iter, 2, &category, -1);
- if (category) {
- if (m_type2)
- query->addCategory2 (category);
- else
- query->addCategory (category);
- return true;
- }
- }
+ if (gtk_tree_selection_get_selected (selection, NULL, &iter))
+ return m_model->writeQuery (query, &iter);
return false;
}
@@ -2264,6 +2297,61 @@
}
};
+class CategoryCombo : public _QueryWidget
+{
+GtkWidget *m_widget, *m_combo;
+CategoryModel *m_model;
+
+public:
+ CategoryCombo() : _QueryWidget()
+ {
+ m_model = new CategoryModel (dynamic_sidebar);
+ m_combo = gtk_combo_box_new_with_model (m_model->getModel());
+
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (m_combo), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (m_combo), renderer,
+ "markup", 0, NULL);
+
+ GtkWidget *label = gtk_label_new_with_mnemonic ("Ca_tegories:");
+ gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), m_combo);
+
+ m_widget = gtk_hbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (m_widget), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_widget), m_combo, TRUE, TRUE, 0);
+ g_signal_connect (G_OBJECT (m_combo), "changed",
+ G_CALLBACK (changed_cb), this);
+ }
+
+ virtual GtkWidget *getWidget()
+ { return m_widget; }
+
+ virtual void updateType (Ypp::Package::Type type)
+ {
+ m_model->setType (type);
+
+ g_signal_handlers_block_by_func (m_combo, (gpointer) changed_cb, this);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_combo), 0);
+ g_signal_handlers_unblock_by_func (m_combo, (gpointer) changed_cb, this);
+ }
+
+ virtual void updateList (Ypp::PkgList list)
+ { m_model->updateList (list); }
+
+ virtual bool begsUpdate() { return dynamic_sidebar; }
+
+ virtual bool writeQuery (Ypp::PkgQuery::Query *query)
+ {
+ GtkTreeIter iter;
+ gtk_combo_box_get_active_iter (GTK_COMBO_BOX (m_combo), &iter);
+ return m_model->writeQuery (query, &iter);
+ }
+
+ static void changed_cb (GtkComboBox *combo, CategoryCombo *pThis)
+ { pThis->notify(); }
+};
+
class StatusView : public _QueryWidget
{
GtkWidget *m_widget, *m_view;
@@ -2382,14 +2470,18 @@
}
};
+#define BROWSER_PATH "/usr/bin/firefox"
+
class DetailBox
{
-GtkWidget *m_widget, *m_text, *m_pkg_view;
+GtkWidget *m_widget, *m_text, *m_pkg_view, *m_link_popup;
+std::string m_link_str;
public:
GtkWidget *getWidget() { return m_widget; }
DetailBox()
+ : m_link_popup (NULL)
{
m_text = ygtk_rich_text_new();
YGtkPackageView *view = ygtk_package_view_new (TRUE);
@@ -2405,10 +2497,18 @@
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (m_widget), vbox);
+ g_signal_connect (G_OBJECT (m_text), "link-clicked",
+ G_CALLBACK (link_clicked_cb), this);
g_signal_connect (G_OBJECT (vbox), "expose-event",
G_CALLBACK (expose_cb), NULL);
}
+ ~DetailBox()
+ {
+ if (m_link_popup)
+ gtk_widget_destroy (m_link_popup);
+ }
+
void setPackage (Ypp::Package *package)
{
if (package) {
@@ -2441,6 +2541,80 @@
cairo_destroy (cr);
return FALSE;
}
+
+ static void link_clicked_cb (YGtkRichText *text, const gchar *link, DetailBox *pThis)
+ {
+ if (!pThis->m_link_popup) {
+ GtkWidget *menu = pThis->m_link_popup = gtk_menu_new();
+ gtk_menu_attach_to_widget (GTK_MENU (menu), GTK_WIDGET (text), NULL);
+
+ GtkWidget *item;
+ if (g_file_test (BROWSER_PATH, G_FILE_TEST_IS_EXECUTABLE)) {
+ std::string label;
+ if (getuid() == 0) {
+ const char *username = getenv ("USERNAME");
+ if (!username || !*username)
+ username = "root";
+ label = _("_Open (as ");
+ label += username;
+ label += ")";
+ }
+ else
+ label = _("_Open");
+ item = gtk_image_menu_item_new_with_mnemonic (label.c_str());
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
+ gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
+ gtk_widget_show (item);
+ g_signal_connect (G_OBJECT (item), "activate",
+ G_CALLBACK (open_link_cb), pThis);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ }
+ item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
+ gtk_widget_show (item);
+ g_signal_connect (G_OBJECT (item), "activate",
+ G_CALLBACK (copy_link_cb), pThis);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ }
+ gtk_menu_popup (GTK_MENU (pThis->m_link_popup), NULL, NULL, NULL, NULL,
+ 0, gtk_get_current_event_time());
+ pThis->m_link_str = link;
+ }
+
+ static void open_link_cb (GtkMenuItem *item, DetailBox *pThis)
+ {
+ const std::string &link = pThis->m_link_str;
+ std::string command;
+ command.reserve (256);
+
+ const char *username = 0;
+ if (getuid() == 0) {
+ username = getenv ("USERNAME");
+ if (!*username)
+ username = 0;
+ }
+
+ if (username) {
+ command += "gnomesu -u ";
+ command += username;
+ command += " -c \"" BROWSER_PATH " --new-window ";
+ command += link;
+ command += "\"";
+ }
+ else {
+ command += BROWSER_PATH " --new-window ";
+ command += link;
+ }
+ command += " &";
+ system (command.c_str());
+ }
+
+ static void copy_link_cb (GtkMenuItem *item, DetailBox *pThis)
+ {
+ const std::string &link = pThis->m_link_str;
+ GtkClipboard *clipboard =
+ gtk_widget_get_clipboard (pThis->m_text, GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_text (clipboard, link.c_str(), -1);
+ }
};
class Toolbar
@@ -2561,6 +2735,12 @@
gtk_widget_set_size_request (search_entry->getWidget(), 160, -1);
}
+ CategoryCombo *category_combo = 0;
+ if (categories_top) {
+ category_combo = new CategoryCombo();
+ m_query.push_back (category_combo);
+ }
+
UndoView *undo_view = 0;
if (undo_side || undo_tab)
undo_view = new UndoView();
@@ -2636,6 +2816,8 @@
gtk_label_set_mnemonic_widget (GTK_LABEL (header), GTK_WIDGET (m_all_view));
gtk_box_pack_start (GTK_BOX (header_box), header, TRUE, TRUE, 0);
}
+ if (category_combo)
+ gtk_box_pack_start (GTK_BOX (header_box), category_combo->getWidget(), FALSE, TRUE, 0);
if (search_entry)
gtk_box_pack_start (GTK_BOX (header_box), search_entry->getWidget(), FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (packages_box), header_box, FALSE, TRUE, 0);
@@ -2643,8 +2825,14 @@
}
GtkWidget *packages_button_box = gtk_vbox_new (FALSE, 4);
- if (status_tabs && arrange_box)
- gtk_box_pack_start (GTK_BOX (packages_button_box), arrange_box, FALSE, TRUE, 0);
+ if (status_tabs && (arrange_box || category_combo)) {
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 6);
+ if (arrange_box)
+ gtk_box_pack_start (GTK_BOX (hbox), arrange_box, FALSE, TRUE, 0);
+ if (category_combo)
+ gtk_box_pack_start (GTK_BOX (hbox), category_combo->getWidget(), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (packages_button_box), hbox, FALSE, TRUE, 0);
+ }
gtk_box_pack_start (GTK_BOX (packages_button_box), packages_box, TRUE, TRUE, 0);
if (!toolbar_top && toolbar_yast)
gtk_box_pack_start (GTK_BOX (packages_button_box), (m_toolbar = new Toolbar (true))->getWidget(), FALSE, TRUE, 0);
Modified: trunk/gtk/src/pkg/yzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.h?rev=6…
==============================================================================
--- trunk/gtk/src/pkg/yzyppwrapper.h (original)
+++ trunk/gtk/src/pkg/yzyppwrapper.h Sun Dec 27 16:50:52 2009
@@ -177,6 +177,7 @@
virtual ~PkgList();
};
+#if 1
// listing of packages as filtered
struct PkgQuery : public PkgList {
struct Query {
@@ -212,6 +213,7 @@
struct Impl;
Impl *impl;
};
+#endif
struct PkgSort : public PkgList {
PkgSort (PkgList list, const std::string &prop, bool ascending);
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r60198 - /trunk/gtk/src/YGPackageSelectorPluginStub.cc
by rpmcruz@svn.opensuse.org 25 Dec '09
by rpmcruz@svn.opensuse.org 25 Dec '09
25 Dec '09
Author: rpmcruz
Date: Fri Dec 25 20:11:58 2009
New Revision: 60198
URL: http://svn.opensuse.org/viewcvs/yast?rev=60198&view=rev
Log:
Typo.
Modified:
trunk/gtk/src/YGPackageSelectorPluginStub.cc
Modified: trunk/gtk/src/YGPackageSelectorPluginStub.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelectorPluginS…
==============================================================================
--- trunk/gtk/src/YGPackageSelectorPluginStub.cc (original)
+++ trunk/gtk/src/YGPackageSelectorPluginStub.cc Fri Dec 25 20:11:58 2009
@@ -52,7 +52,7 @@
if (!strcmp (arg, "help-pkg")) {
printf ("sw_single gtk [OPTIONS]:\n");
for (int i = 0; i < arguments_nb; i++)
- printf ("\t%s=y/n\t\t(default: %c)\n",
+ printf ("\t--%s=y/n\t\t(default: %c)\n",
arguments[i].arg, *arguments[i].var ? 'y' : 'n');
exit (0);
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r60197 - in /trunk/gtk: ChangeLog src/YGPackageSelectorPluginStub.cc src/pkg/YGPackageSelector.cc src/pkg/yzyppwrapper.cc
by rpmcruz@svn.opensuse.org 25 Dec '09
by rpmcruz@svn.opensuse.org 25 Dec '09
25 Dec '09
Author: rpmcruz
Date: Fri Dec 25 18:16:32 2009
New Revision: 60197
URL: http://svn.opensuse.org/viewcvs/yast?rev=60197&view=rev
Log:
* src/pkg/YGPackageSelector.cc: added --arrange-by
flag as suggested by Christian Jaeger's mockup.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGPackageSelectorPluginStub.cc
trunk/gtk/src/pkg/YGPackageSelector.cc
trunk/gtk/src/pkg/yzyppwrapper.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=60197&r1=60196…
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Fri Dec 25 18:16:32 2009
@@ -3,6 +3,9 @@
* src/pkg/YGPackageSelector.cc: fixed crash when
search-entry-top=n (which was default).
+ * src/pkg/YGPackageSelector.cc: added --arrange-by
+ flag as suggested by Christian Jaeger's mockup.
+
2009-12-24 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
* src/pkg/YGPackageSelector.cc: added a bunch of flags
Modified: trunk/gtk/src/YGPackageSelectorPluginStub.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelectorPluginS…
==============================================================================
--- trunk/gtk/src/YGPackageSelectorPluginStub.cc (original)
+++ trunk/gtk/src/YGPackageSelectorPluginStub.cc Fri Dec 25 18:16:32 2009
@@ -43,7 +43,7 @@
{ "details-start-hide", &details_start_hide },
{ "toolbar-top", &toolbar_top },
{ "toolbar-yast", &toolbar_yast },
-// { "arrange-by", &arrange_by },
+ { "arrange-by", &arrange_by },
};
static const int arguments_nb = sizeof (arguments) / sizeof (Arg);
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc…
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Fri Dec 25 18:16:32 2009
@@ -2529,7 +2529,7 @@
class UI : public YGtkPackageView::Listener, _QueryListener, Ypp::Disk::Listener
{
-GtkWidget *m_widget, *m_disk_label;
+GtkWidget *m_widget, *m_disk_label, *m_arrange_combo;
YGtkPackageView *m_all_view, *m_installed_view, *m_available_view, *m_upgrades_view;
std::list <_QueryWidget *> m_query;
DetailBox *m_details;
@@ -2543,6 +2543,7 @@
UI (YPackageSelector *sel)
{
m_toolbar = 0;
+ m_arrange_combo = 0;
if (sel->onlineUpdateMode())
m_type = Ypp::Package::PATCH_TYPE;
@@ -2564,6 +2565,20 @@
if (undo_side || undo_tab)
undo_view = new UndoView();
+ GtkWidget *arrange_box = 0;
+ if (arrange_by) {
+ arrange_box = gtk_hbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (arrange_box), gtk_label_new (_("Software arranged by")), FALSE, TRUE, 0);
+ m_arrange_combo = gtk_combo_box_new_text();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_arrange_combo), _("Groups"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_arrange_combo), _("Repositories"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_arrange_combo), _("Status"));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_arrange_combo), 0);
+ gtk_box_pack_start (GTK_BOX (arrange_box), m_arrange_combo, FALSE, TRUE, 0);
+ g_signal_connect (G_OBJECT (m_arrange_combo), "changed",
+ G_CALLBACK (arrange_combo_changed_cb), this);
+ }
+
GtkWidget *packages_box;
if (status_tabs) {
m_installed_view = ygtk_package_view_new (TRUE);
@@ -2611,10 +2626,16 @@
packages_box = gtk_vbox_new (FALSE, 4);
GtkWidget *header_box = gtk_hbox_new (FALSE, 6);
- GtkWidget *header = gtk_label_new_with_mnemonic (_("_Listing:"));
- gtk_misc_set_alignment (GTK_MISC (header), 0, .5);
- gtk_label_set_mnemonic_widget (GTK_LABEL (header), GTK_WIDGET (m_all_view));
- gtk_box_pack_start (GTK_BOX (header_box), header, TRUE, TRUE, 0);
+ if (arrange_box) {
+ gtk_box_pack_start (GTK_BOX (header_box), arrange_box, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (header_box), gtk_event_box_new(), TRUE, TRUE, 0);
+ }
+ else {
+ GtkWidget *header = gtk_label_new_with_mnemonic (_("_Listing:"));
+ gtk_misc_set_alignment (GTK_MISC (header), 0, .5);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (header), GTK_WIDGET (m_all_view));
+ gtk_box_pack_start (GTK_BOX (header_box), header, TRUE, TRUE, 0);
+ }
if (search_entry)
gtk_box_pack_start (GTK_BOX (header_box), search_entry->getWidget(), FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (packages_box), header_box, FALSE, TRUE, 0);
@@ -2622,6 +2643,8 @@
}
GtkWidget *packages_button_box = gtk_vbox_new (FALSE, 4);
+ if (status_tabs && arrange_box)
+ gtk_box_pack_start (GTK_BOX (packages_button_box), arrange_box, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (packages_button_box), packages_box, TRUE, TRUE, 0);
if (!toolbar_top && toolbar_yast)
gtk_box_pack_start (GTK_BOX (packages_button_box), (m_toolbar = new Toolbar (true))->getWidget(), FALSE, TRUE, 0);
@@ -2708,15 +2731,13 @@
updateDisk();
Ypp::get()->getDisk()->addListener (this);
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 6);
if (toolbar_top) {
m_toolbar = new Toolbar (false);
- m_widget = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (m_widget), m_toolbar->getWidget(), FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_widget), side_pane, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), m_toolbar->getWidget(), FALSE, TRUE, 0);
}
- else
- m_widget = side_pane;
-
+ gtk_box_pack_start (GTK_BOX (vbox), side_pane, TRUE, TRUE, 0);
+ m_widget = vbox;
gtk_widget_show_all (m_widget);
if (details_start_hide) {
@@ -2755,48 +2776,111 @@
virtual void refresh()
{
- Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
- for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
- it != m_query.end(); it++)
- (*it)->modified = (*it)->writeQuery (query);
-
- Ypp::PkgQuery list (m_type, query);
if (m_all_view)
- m_all_view->setList (list, NULL);
+ m_all_view->clear();
+ if (m_installed_view)
+ m_installed_view->clear();
+ if (m_available_view)
+ m_available_view->clear();
+ if (m_upgrades_view)
+ m_upgrades_view->clear();
+
+ // for arrange_by
+ const char *header = 0;
+ Ypp::Node *category;
- if (m_installed_view) {
- Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
- query->setIsInstalled (true);
- Ypp::PkgQuery _list (list, query);
- m_installed_view->setList (_list, NULL);
- }
- if (m_available_view) {
+ for (int cycle = 0; true; cycle++) { // for arrange_by
Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
- query->setIsInstalled (false);
- Ypp::PkgQuery _list (list, query);
- m_available_view->setList (_list, NULL);
- }
- if (m_upgrades_view) {
- Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
- query->setHasUpgrade (true);
- Ypp::PkgQuery _list (list, query);
- m_upgrades_view->setList (_list, NULL);
- }
+ for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
+ it != m_query.end(); it++)
+ (*it)->modified = (*it)->writeQuery (query);
+
+ if (arrange_by) {
+ int arrange = gtk_combo_box_get_active (GTK_COMBO_BOX (m_arrange_combo));
+ if (arrange == 0) { // groups
+ if (cycle == 0)
+ category = Ypp::get()->getFirstCategory2 (Ypp::Package::PACKAGE_TYPE);
+ else
+ category = category->next();
+ if (!category)
+ break;
+ header = category->name.c_str();
+ query->addCategory2 (category);
+ }
+ else if (arrange == 1) { // repositories
+ const Ypp::Repository *repo = Ypp::get()->getRepository (cycle);
+ if (repo) {
+ header = repo->name.c_str();
+ query->addRepository (repo);
+ }
+ else
+ break;
+ }
+ else if (arrange == 2) { // statuses
+ if (cycle == 0) {
+ header = _("Available");
+ query->setIsInstalled (false);
+ }
+ else if (cycle == 1) {
+ header = _("Upgrades");
+ query->setHasUpgrade (true);
+ }
+ else if (cycle == 2) {
+ header = _("Installed");
+ query->setIsInstalled (true);
+ }
+ else if (cycle == 3) {
+ header = _("Modified");
+ query->setToModify (true);
+ }
+ else
+ break;
+ }
+ }
- for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
- it != m_query.end(); it++)
- if ((*it)->begsUpdate()) {
- if ((*it)->modified)
- updateWidget (*it);
- else
- (*it)->updateList (list);
+ Ypp::PkgQuery list (m_type, query);
+ if (m_all_view)
+// m_all_view->setList (list, NULL);
+ m_all_view->packList (header, list, NULL);
+
+ if (m_installed_view) {
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ query->setIsInstalled (true);
+ Ypp::PkgQuery _list (list, query);
+ m_installed_view->packList (header, _list, NULL);
+ }
+ if (m_available_view) {
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ query->setIsInstalled (false);
+ Ypp::PkgQuery _list (list, query);
+ m_available_view->packList (header, _list, NULL);
}
+ if (m_upgrades_view) {
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ query->setHasUpgrade (true);
+ Ypp::PkgQuery _list (list, query);
+ m_upgrades_view->packList (header, _list, _("Upgrade all"));
+ }
+
+ for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
+ it != m_query.end(); it++)
+ if ((*it)->begsUpdate()) {
+ if ((*it)->modified)
+ updateWidget (*it);
+ else
+ (*it)->updateList (list);
+ }
+
+ if (!arrange_by)
+ break;
+ }
}
virtual void packagesSelected (Ypp::PkgList packages)
{
m_details->setPackage (packages.size() ? packages.get (0) : NULL);
- m_toolbar->setPackages (packages);
+ if (m_toolbar)
+ m_toolbar->setPackages (packages);
}
virtual void updateDisk()
@@ -2836,6 +2920,11 @@
(*it)->updateType (pThis->m_type);
pThis->refresh();
}
+
+ static void arrange_combo_changed_cb (GtkComboBox *combo, UI *pThis)
+ {
+ pThis->refresh();
+ }
};
#include "pkg-selector-help.h"
Modified: trunk/gtk/src/pkg/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.cc?rev=…
==============================================================================
--- trunk/gtk/src/pkg/yzyppwrapper.cc (original)
+++ trunk/gtk/src/pkg/yzyppwrapper.cc Fri Dec 25 18:16:32 2009
@@ -1994,6 +1994,17 @@
bool clear;
Ypp::Package *highlight;
+#if 0
+ template <typename T>
+ struct PropKey {
+ T property;
+ T value;
+ };
+ std::list <PropKey <bool> > boolKeys;
+ std::list <PropKey <int > > intKeys;
+ std::list <PropKey <std::string > > strKeys;
+#endif
+
Impl() : clear (false), highlight (NULL)
{}
@@ -2028,6 +2039,28 @@
if (clear)
return false;
bool match = true;
+#if 0
+ for (std::list <PropKey <bool> >::const_iterator it = boolKeys.begin();
+ it != boolKeys.end(); it++) {
+ const PropKey <bool> &key = *it;
+ if (package->getPropertyBool (key.property) != key.value)
+ return false;
+ }
+ for (std::list <PropKey <int> >::const_iterator it = intKeys.begin();
+ it != intKeys.end(); it++) {
+ const PropKey <int> &key = *it;
+ if (package->getPropertyInt (key.property) != key.value)
+ return false;
+ }
+ bool str_match = false;
+ for (std::list <PropKey <std::string> >::const_iterator it = strKeys.begin();
+ it != strKeys.end(); it++) {
+ const PropKey <std::string> &key = *it;
+ std::string pkg_value = package->getPropertyStr (key.property);
+ if (pkg_value != key.value)
+ return false;
+ }
+#endif
if (match && (isInstalled.defined || hasUpgrade.defined)) {
// only one of the specified status must match
bool status_match = false;
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r60196 - in /trunk/gtk: ChangeLog src/YGPackageSelectorPluginStub.cc src/pkg/YGPackageSelector.cc
by rpmcruz@svn.opensuse.org 25 Dec '09
by rpmcruz@svn.opensuse.org 25 Dec '09
25 Dec '09
Author: rpmcruz
Date: Fri Dec 25 16:37:44 2009
New Revision: 60196
URL: http://svn.opensuse.org/viewcvs/yast?rev=60196&view=rev
Log:
* src/pkg/YGPackageSelector.cc: fixed crash when
search-entry-top=n (which was default).
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGPackageSelectorPluginStub.cc
trunk/gtk/src/pkg/YGPackageSelector.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=60196&r1=60195…
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Fri Dec 25 16:37:44 2009
@@ -1,3 +1,8 @@
+2009-12-25 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
+
+ * src/pkg/YGPackageSelector.cc: fixed crash when
+ search-entry-top=n (which was default).
+
2009-12-24 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
* src/pkg/YGPackageSelector.cc: added a bunch of flags
Modified: trunk/gtk/src/YGPackageSelectorPluginStub.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelectorPluginS…
==============================================================================
--- trunk/gtk/src/YGPackageSelectorPluginStub.cc (original)
+++ trunk/gtk/src/YGPackageSelectorPluginStub.cc Fri Dec 25 16:37:44 2009
@@ -12,11 +12,12 @@
#include <string.h>
bool search_entry_side = true, search_entry_top = false, dynamic_sidebar = false,
- status_side = false, status_tabs = true, status_tabs_as_actions = false,
- undo_side = false, undo_tab = true, undo_old_style = false, status_col = false,
- action_col = true, action_col_as_button = true, action_col_as_check = false,
- version_col = true, single_line_rows = false, details_start_hide = true,
- toolbar_top = false, toolbar_yast = false;
+ categories_side = true, status_side = false, status_tabs = true,
+ status_tabs_as_actions = false, undo_side = false, undo_tab = true,
+ undo_old_style = false, status_col = false, action_col = true,
+ action_col_as_button = true, action_col_as_check = false, version_col = true,
+ single_line_rows = false, details_start_hide = true, toolbar_top = false,
+ toolbar_yast = false, arrange_by = false;
struct Arg {
const char *arg;
@@ -26,6 +27,7 @@
{ "search-entry-side", &search_entry_side },
{ "search-entry-top", &search_entry_top },
{ "dynamic-sidebar", &dynamic_sidebar },
+ { "categories-side", &categories_side },
{ "status-side", &status_side },
{ "status-tabs", &status_tabs },
{ "status-tabs-as-actions", &status_tabs_as_actions },
@@ -41,6 +43,7 @@
{ "details-start-hide", &details_start_hide },
{ "toolbar-top", &toolbar_top },
{ "toolbar-yast", &toolbar_yast },
+// { "arrange-by", &arrange_by },
};
static const int arguments_nb = sizeof (arguments) / sizeof (Arg);
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc…
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Fri Dec 25 16:37:44 2009
@@ -28,10 +28,10 @@
// experiments:
extern bool search_entry_side, search_entry_top, dynamic_sidebar,
- status_side, status_tabs, status_tabs_as_actions, undo_side, undo_tab,
- undo_old_style, status_col, action_col, action_col_as_button,
- action_col_as_check, version_col, single_line_rows, details_start_hide,
- toolbar_top, toolbar_yast;
+ categories_side, status_side, status_tabs, status_tabs_as_actions,
+ undo_side, undo_tab, undo_old_style, status_col, action_col,
+ action_col_as_button, action_col_as_check, version_col, single_line_rows,
+ details_start_hide, toolbar_top, toolbar_yast, arrange_by;
//** UI components -- split up for re-usability, but mostly for readability
@@ -2554,10 +2554,11 @@
m_all_view = m_installed_view = m_available_view = m_upgrades_view = NULL;
_QueryWidget *search_entry = 0;
- if (search_entry_top)
+ if (search_entry_top) {
search_entry = new SearchEntry (false);
- m_query.push_back (search_entry);
- gtk_widget_set_size_request (search_entry->getWidget(), 160, -1);
+ m_query.push_back (search_entry);
+ gtk_widget_set_size_request (search_entry->getWidget(), 160, -1);
+ }
UndoView *undo_view = 0;
if (undo_side || undo_tab)
@@ -2597,10 +2598,11 @@
box, gtk_label_new_with_mnemonic (labels[3]));
}
- if (search_entry)
+ if (search_entry) {
// FIXME: only the entry itself is shown, without the "Find:" label
ygtk_notebook_set_corner_widget (
YGTK_NOTEBOOK (packages_box), search_entry->getWidget());
+ }
}
else {
m_all_view = ygtk_package_view_new (TRUE);
@@ -2679,11 +2681,12 @@
gtk_box_pack_start (GTK_BOX (side_vbox), search_entry->getWidget(), FALSE, TRUE, 0);
}
- _QueryWidget *categories = new CategoryView();
- m_query.push_back (categories);
-
GtkWidget *cat_pane = gtk_vpaned_new();
- gtk_paned_pack1 (GTK_PANED (cat_pane), categories->getWidget(), TRUE, FALSE);
+ if (categories_side) {
+ _QueryWidget *categories = new CategoryView();
+ m_query.push_back (categories);
+ gtk_paned_pack1 (GTK_PANED (cat_pane), categories->getWidget(), TRUE, FALSE);
+ }
if (status_side) {
_QueryWidget *statuses = new StatusView();
m_query.push_back (statuses);
@@ -2723,6 +2726,8 @@
}
else
m_details->setPackage (NULL);
+ if (!categories_side && !search_entry_side && !status_side)
+ gtk_widget_hide (side_vbox);
}
~UI()
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r60195 - in /trunk/gtk: ChangeLog src/YGPackageSelectorPluginStub.cc src/pkg/YGPackageSelector.cc src/pkg/ygtknotebook.c src/pkg/ygtkpackageview.cc src/ygtkfindentry.c
by rpmcruz@svn.opensuse.org 24 Dec '09
by rpmcruz@svn.opensuse.org 24 Dec '09
24 Dec '09
Author: rpmcruz
Date: Thu Dec 24 16:17:46 2009
New Revision: 60195
URL: http://svn.opensuse.org/viewcvs/yast?rev=60195&view=rev
Log:
* src/pkg/YGPackageSelector.cc: added a bunch of flags
for experimental purposes. Try:
/usr/lib/YaST2/bin/y2base sw_single gtk --help-pkg
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGPackageSelectorPluginStub.cc
trunk/gtk/src/pkg/YGPackageSelector.cc
trunk/gtk/src/pkg/ygtknotebook.c
trunk/gtk/src/pkg/ygtkpackageview.cc
trunk/gtk/src/ygtkfindentry.c
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=60195&r1=60194…
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Thu Dec 24 16:17:46 2009
@@ -1,3 +1,9 @@
+2009-12-24 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
+
+ * src/pkg/YGPackageSelector.cc: added a bunch of flags
+ for experimental purposes. Try:
+ /usr/lib/YaST2/bin/y2base sw_single gtk --help-pkg
+
2009-12-03 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
* src/YGUtils.cc: proper fix for bug 549943: we
Modified: trunk/gtk/src/YGPackageSelectorPluginStub.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelectorPluginS…
==============================================================================
--- trunk/gtk/src/YGPackageSelectorPluginStub.cc (original)
+++ trunk/gtk/src/YGPackageSelectorPluginStub.cc Thu Dec 24 16:17:46 2009
@@ -11,17 +11,57 @@
#include <YEvent.h>
#include <string.h>
-bool show_find_pane = false, use_buttons = false, show_novelty_filter = false;
+bool search_entry_side = true, search_entry_top = false, dynamic_sidebar = false,
+ status_side = false, status_tabs = true, status_tabs_as_actions = false,
+ undo_side = false, undo_tab = true, undo_old_style = false, status_col = false,
+ action_col = true, action_col_as_button = true, action_col_as_check = false,
+ version_col = true, single_line_rows = false, details_start_hide = true,
+ toolbar_top = false, toolbar_yast = false;
+
+struct Arg {
+ const char *arg;
+ bool *var;
+};
+Arg arguments[] = {
+ { "search-entry-side", &search_entry_side },
+ { "search-entry-top", &search_entry_top },
+ { "dynamic-sidebar", &dynamic_sidebar },
+ { "status-side", &status_side },
+ { "status-tabs", &status_tabs },
+ { "status-tabs-as-actions", &status_tabs_as_actions },
+ { "undo-side", &undo_side },
+ { "undo-tab", &undo_tab },
+ { "undo-old-style", &undo_old_style },
+ { "status-col", &status_col },
+ { "action-col", &action_col },
+ { "action-col-as-button", &action_col_as_button },
+ { "action-col-as-check", &action_col_as_check },
+ { "version-col", &version_col },
+ { "single-line-rows", &single_line_rows },
+ { "details-start-hide", &details_start_hide },
+ { "toolbar-top", &toolbar_top },
+ { "toolbar-yast", &toolbar_yast },
+};
+static const int arguments_nb = sizeof (arguments) / sizeof (Arg);
+
bool YGUI::pkgSelectorParse (const char *arg)
{
- if (!strcmp (arg, "find-pane"))
- show_find_pane = true;
- else if (!strcmp (arg, "buttons"))
- use_buttons = true;
- else if (!strcmp (arg, "novelty-filter"))
- show_novelty_filter = true;
- else return false;
- return true;
+ if (!strcmp (arg, "help-pkg")) {
+ printf ("sw_single gtk [OPTIONS]:\n");
+ for (int i = 0; i < arguments_nb; i++)
+ printf ("\t%s=y/n\t\t(default: %c)\n",
+ arguments[i].arg, *arguments[i].var ? 'y' : 'n');
+ exit (0);
+ }
+ for (int i = 0; i < arguments_nb; i++) {
+ int arg_len = strlen (arguments[i].arg);
+ if (!strncmp (arg, arguments[i].arg, arg_len) && arg[arg_len] == '=') {
+ *arguments[i].var = arg[arg_len+1] == 'y';
+fprintf (stderr, "found '%s' as '%s' = '%d'\n", arg, arguments[i].arg, *arguments[i].var);
+ return true;
+ }
+ }
+ return false;
}
void YGUI::pkgSelectorSize (int *width, int *height)
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc…
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Thu Dec 24 16:17:46 2009
@@ -24,27 +24,30 @@
#include "ygtkpackageview.h"
#include "ygtkdetailview.h"
#include "ygtkdiskview.h"
+#include "ygtknotebook.h"
// experiments:
-extern bool show_find_pane, use_buttons, show_novelty_filter;
+extern bool search_entry_side, search_entry_top, dynamic_sidebar,
+ status_side, status_tabs, status_tabs_as_actions, undo_side, undo_tab,
+ undo_old_style, status_col, action_col, action_col_as_button,
+ action_col_as_check, version_col, single_line_rows, details_start_hide,
+ toolbar_top, toolbar_yast;
//** UI components -- split up for re-usability, but mostly for readability
-#if 0
class UndoView
{
-GtkWidget *m_vbox;
Ypp::PkgList m_changes;
public:
- GtkWidget *getWidget() { return m_vbox; }
+// GtkWidget *getWidget() { return m_vbox; }
- UndoView (YGtkPackageView::Listener *listener)
+ UndoView()
{
Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
query->setToModify (true);
m_changes = Ypp::PkgQuery (Ypp::Package::PACKAGE_TYPE, query);
-
+#if 0
GtkWidget *view = createView (listener);
m_vbox = gtk_vbox_new (FALSE, 6);
@@ -66,38 +69,41 @@
#endif
gtk_widget_show_all (m_vbox);
g_object_ref_sink (m_vbox);
+#endif
}
+#if 0
~UndoView()
{ g_object_unref (m_vbox); }
+#endif
- GtkWidget *createView (YGtkPackageView::Listener *listener)
+ GtkWidget *createView (YGtkPackageView::Listener *listener, bool horizontal)
{
- GtkWidget *hbox = gtk_hbox_new (TRUE, 6);
+ GtkWidget *main_box = horizontal ? gtk_hbox_new (TRUE, 6) : gtk_vbox_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;
+ const char *prop;
switch (i) {
case 0:
str = _("To install:");
stock = GTK_STOCK_ADD;
query->setToInstall (true);
query->setIsInstalled (false);
- checkCol = TO_INSTALL_PROP;
+ prop = "to-install";
break;
case 1:
str = _("To upgrade:");
stock = GTK_STOCK_GO_UP;
query->setToInstall (true);
query->setIsInstalled (true);
- checkCol = TO_UPGRADE_PROP;
+ prop = "to-upgrade";
break;
case 2:
str = _("To remove:");
stock = GTK_STOCK_REMOVE;
query->setToRemove (true);
- checkCol = TO_REMOVE_PROP;
+ prop = "to-remove";
break;
default: break;
}
@@ -111,8 +117,9 @@
gtk_box_pack_start (GTK_BOX (label_box), icon, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (label_box), label, TRUE, TRUE, 0);
YGtkPackageView *view = ygtk_package_view_new (FALSE);
- view->appendCheckColumn (checkCol);
- view->appendTextColumn (NULL, NAME_PROP, -1, true);
+ view->setVisible ("available-version", false);
+/* view->appendCheckColumn (checkCol);
+ view->appendTextColumn (NULL, NAME_PROP, -1, true);*/
view->setActivateAction (YGtkPackageView::UNDO_ACTION);
view->setList (list, NULL);
view->setListener (listener);
@@ -122,11 +129,11 @@
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), GTK_WIDGET (view), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), box, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (main_box), box, TRUE, TRUE, 0);
}
- return hbox;
+ return main_box;
}
-
+#if 0
private:
static void uncouple_clicked_cb (GtkButton *button, UndoView *pThis)
{
@@ -142,7 +149,7 @@
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (close_response_cb), pThis);
- GtkWidget *view = pThis->createView (NULL);
+ GtkWidget *view = pThis->createView (NULL, true);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), view);
gtk_widget_show_all (dialog);
}
@@ -159,8 +166,175 @@
gtk_widget_show (pThis->m_vbox);
gtk_widget_destroy (GTK_WIDGET (dialog));
}
+#endif
+};
+
+class ChangesPane : public Ypp::PkgList::Listener
+{
+ struct Entry {
+ GtkWidget *m_box, *m_label, *m_button;
+ GtkWidget *getWidget() { return m_box; }
+
+ Entry (Ypp::Package *package)
+ {
+ m_label = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (m_label), 0, 0.5);
+ gtk_label_set_ellipsize (GTK_LABEL (m_label), PANGO_ELLIPSIZE_END);
+ m_button = gtk_button_new();
+ gtk_widget_set_tooltip_text (m_button, _("Undo"));
+ GtkWidget *undo_image = gtk_image_new_from_stock (GTK_STOCK_UNDO, GTK_ICON_SIZE_MENU);
+ gtk_button_set_image (GTK_BUTTON (m_button), undo_image);
+ m_box = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (m_box), m_label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_box), m_button, FALSE, FALSE, 0);
+ gtk_widget_show_all (m_box);
+ modified (package);
+ g_signal_connect (G_OBJECT (m_button), "clicked",
+ G_CALLBACK (undo_clicked_cb), package);
+ }
+
+ void modified (Ypp::Package *package)
+ {
+ const Ypp::Package::Version *version = 0;
+ std::string text, action;
+ if (package->toInstall (&version)) {
+ if (package->isInstalled()) {
+ if (version->cmp > 0)
+ action = _("upgrade");
+ else if (version->cmp < 0)
+ action = _("downgrade");
+ else
+ action = _("re-install");
+ }
+ else if (package->type() == Ypp::Package::PATCH_TYPE)
+ action = _("patch");
+ else
+ action = _("install");
+ }
+ else
+ action = _("remove");
+ text = action + " " + package->name();
+ if (package->isAuto()) {
+ text = "\t" + text;
+ gtk_widget_hide (m_button);
+ }
+ else
+ gtk_widget_show (m_button);
+ gtk_label_set_text (GTK_LABEL (m_label), text.c_str());
+ std::string tooltip = action + " " + package->name();
+ if (version)
+ tooltip += std::string (_("\nfrom")) + " <i>" + version->repo->name + "</i>";
+ gtk_widget_set_tooltip_markup (m_label, tooltip.c_str());
+ }
+
+ static void undo_clicked_cb (GtkButton *button, Ypp::Package *package)
+ {
+ package->undo();
+ }
+ };
+
+GtkWidget *m_box, *m_entries_box;
+Ypp::PkgList m_pool;
+GList *m_entries;
+
+public:
+ GtkWidget *getWidget()
+ { return m_box; }
+
+ ChangesPane()
+ : m_entries (NULL)
+ {
+ GtkWidget *heading = gtk_label_new (_("Changes:"));
+ YGUtils::setWidgetFont (heading, PANGO_STYLE_NORMAL, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+ gtk_misc_set_alignment (GTK_MISC (heading), 0, 0.5);
+ m_entries_box = gtk_vbox_new (FALSE, 4);
+
+ GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll),
+ m_entries_box);
+ GtkWidget *port = gtk_bin_get_child (GTK_BIN (scroll));
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (port), GTK_SHADOW_NONE);
+
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
+ gtk_box_pack_start (GTK_BOX (vbox), heading, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
+
+ ygtk_wizard_set_information_expose_hook (vbox, &vbox->allocation);
+ ygtk_wizard_set_information_expose_hook (m_entries_box, &m_entries_box->allocation);
+
+ int width = YGUtils::getCharsWidth (vbox, 32);
+ gtk_widget_set_size_request (vbox, width, -1);
+ gtk_widget_show_all (vbox);
+
+ m_box = gtk_handle_box_new();
+ gtk_container_add (GTK_CONTAINER (m_box), vbox);
+ gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (m_box), GTK_POS_TOP);
+ gtk_handle_box_set_snap_edge (GTK_HANDLE_BOX (m_box), GTK_POS_RIGHT);
+
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ query->setToModify (true);
+/* if (pkg_selector->onlineUpdateMode())
+ query->addType (Ypp::Package::PATCH_TYPE);*/
+ m_pool = Ypp::PkgQuery (Ypp::Package::PACKAGE_TYPE, query);
+ // initialize list -- there could already be packages modified
+ for (int i = 0; i < m_pool.size(); i++)
+ ChangesPane::entryInserted (m_pool, i, m_pool.get (i));
+ m_pool.addListener (this);
+ }
+
+ ~ChangesPane()
+ {
+ for (GList *i = m_entries; i; i = i->next)
+ delete (Entry *) i->data;
+ g_list_free (m_entries);
+ }
+
+ void startHack() // call after init, after you did a show_all in the dialog
+ {
+ UpdateVisible();
+ // ugly: signal modified for all entries to allow them to hide undo buttons
+ GList *i;
+ int index;
+ for (index = 0, i = m_entries; index < m_pool.size() && i;
+ index++, i = i->next)
+ ((Entry *) i->data)->modified (m_pool.get (index));
+ }
+
+ void UpdateVisible()
+ {
+ if (details_start_hide)
+ m_entries != NULL ? gtk_widget_show (m_box) : gtk_widget_hide (m_box);
+ }
+
+ virtual void entryInserted (const Ypp::PkgList list, int index, Ypp::Package *package)
+ {
+ Entry *entry = new Entry (package);
+ gtk_box_pack_start (GTK_BOX (m_entries_box), entry->getWidget(), FALSE, TRUE, 0);
+ m_entries = g_list_insert (m_entries, entry, index);
+ UpdateVisible();
+ }
+
+ virtual void entryDeleted (const Ypp::PkgList list, int index, Ypp::Package *package)
+ {
+ GList *i = g_list_nth (m_entries, index);
+ Entry *entry = (Entry *) i->data;
+ gtk_container_remove (GTK_CONTAINER (m_entries_box), entry->getWidget());
+ delete entry;
+ m_entries = g_list_delete_link (m_entries, i);
+ UpdateVisible();
+ }
+
+ virtual void entryChanged (const Ypp::PkgList list, int index, Ypp::Package *package)
+ {
+ Entry *entry = (Entry *) g_list_nth_data (m_entries, index);
+ entry->modified (package);
+ }
};
+#if 0
struct QueryListener {
virtual void queryNotify() = 0;
virtual void queryNotifyDelay() = 0;
@@ -1807,6 +1981,8 @@
timeout_id = g_timeout_add (500, inner::timeout_cb, this);
}
+ bool modified; // flag for internal use
+
private:
_QueryListener *m_listener;
};
@@ -1817,16 +1993,17 @@
bool m_clearIcon;
public:
- SearchEntry() : _QueryWidget()
+ SearchEntry (bool combo_props) : _QueryWidget()
{
m_entry = gtk_entry_new();
g_signal_connect (G_OBJECT (m_entry), "realize",
G_CALLBACK (grab_focus_cb), NULL);
gtk_widget_set_size_request (m_entry, 50, -1);
GtkWidget *entry_hbox = gtk_hbox_new (FALSE, 2), *find_label;
- find_label = gtk_label_new (_("Find:"));
+ find_label = gtk_label_new_with_mnemonic (_("_Find:"));
gtk_box_pack_start (GTK_BOX (entry_hbox), find_label, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (entry_hbox), m_entry, TRUE, TRUE, 0);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (find_label), m_entry);
m_clearIcon = false;
g_signal_connect (G_OBJECT (m_entry), "changed",
@@ -1834,28 +2011,34 @@
g_signal_connect (G_OBJECT (m_entry), "icon-press",
G_CALLBACK (icon_press_cb), this);
- m_combo = gtk_combo_box_new_text();
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo), _("Name & Summary"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo), _("Description"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo), _("File List"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo), _("Author"));
- gtk_combo_box_set_active (GTK_COMBO_BOX (m_combo), 0);
- g_signal_connect (G_OBJECT (m_combo), "changed",
- G_CALLBACK (combo_changed_cb), this);
-
- GtkWidget *opt_hbox = gtk_hbox_new (FALSE, 2), *empty = gtk_event_box_new();
- gtk_box_pack_start (GTK_BOX (opt_hbox), empty, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (opt_hbox), gtk_label_new (_("by")), FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (opt_hbox), m_combo, TRUE, TRUE, 0);
-
- GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- gtk_size_group_add_widget (group, find_label);
- gtk_size_group_add_widget (group, empty);
- g_object_unref (G_OBJECT (group));
-
- m_widget = gtk_vbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (m_widget), entry_hbox, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_widget), opt_hbox, FALSE, TRUE, 0);
+ m_combo = 0;
+ if (combo_props) {
+ m_combo = gtk_combo_box_new_text();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo), _("Name & Summary"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo), _("Description"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo), _("File List"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_combo), _("Author"));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_combo), 0);
+ g_signal_connect (G_OBJECT (m_combo), "changed",
+ G_CALLBACK (combo_changed_cb), this);
+
+ GtkWidget *opt_hbox = gtk_hbox_new (FALSE, 2), *empty = gtk_event_box_new();
+ gtk_box_pack_start (GTK_BOX (opt_hbox), empty, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (opt_hbox), gtk_label_new (_("by")), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (opt_hbox), m_combo, TRUE, TRUE, 0);
+
+ GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ gtk_size_group_add_widget (group, find_label);
+ gtk_size_group_add_widget (group, empty);
+ g_object_unref (G_OBJECT (group));
+
+ m_widget = gtk_vbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (m_widget), entry_hbox, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_widget), opt_hbox, FALSE, TRUE, 0);
+ }
+ else
+ m_widget = entry_hbox;
+ gtk_widget_show_all (m_widget);
}
virtual GtkWidget *getWidget() { return m_widget; }
@@ -1868,7 +2051,9 @@
{
const gchar *name = gtk_entry_get_text (GTK_ENTRY (m_entry));
if (*name) {
- int opt = gtk_combo_box_get_active (GTK_COMBO_BOX (m_combo));
+ int opt = 0;
+ if (m_combo)
+ opt = gtk_combo_box_get_active (GTK_COMBO_BOX (m_combo));
bool whole_word = opt >= 2;
query->addNames (name, ' ', opt == 0, opt == 0, opt == 1, opt == 2,
opt == 3, whole_word);
@@ -1964,15 +2149,19 @@
m_type2 = false;
m_view = tree_view_new();
GtkWidget *scroll = scrolled_window_new (m_view);
-
+#if 0
GtkWidget *combo = gtk_combo_box_new_text();
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Categories"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Repositories"));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
g_signal_connect (G_OBJECT (combo), "changed",
G_CALLBACK (combo_changed_cb), this);
+#endif
+ GtkWidget *combo = gtk_label_new_with_mnemonic ("Ca_tegories:");
+ gtk_misc_set_alignment (GTK_MISC (combo), 0, 0);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (combo), m_view);
- GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 4); //0);
gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
m_widget = vbox;
@@ -1995,6 +2184,8 @@
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_POINTER);
m_model = GTK_TREE_MODEL (store);
gtk_list_store_append (store, &iter);
+ if (!dynamic_sidebar)
+ gtk_list_store_set (store, &iter, 0, _("All packages"), -1);
gtk_list_store_set (store, &iter, 1, TRUE, 2, NULL, -1);
Ypp::Node *category;
if (m_type2)
@@ -2003,6 +2194,8 @@
category = Ypp::get()->getFirstCategory (type);
for (; category; category = category->next()) {
gtk_list_store_append (store, &iter);
+ if (!dynamic_sidebar)
+ gtk_list_store_set (store, &iter, 0, category->name.c_str(), -1);
gtk_list_store_set (store, &iter, 1, TRUE, 2, category, -1);
}
GtkTreeModel *filter_model = gtk_tree_model_filter_new (m_model, NULL);
@@ -2044,7 +2237,7 @@
} while (gtk_tree_model_iter_next (model, &iter));
}
- virtual bool begsUpdate() { return true; }
+ virtual bool begsUpdate() { return dynamic_sidebar; }
virtual bool writeQuery (Ypp::PkgQuery::Query *query)
{
@@ -2080,21 +2273,38 @@
StatusView() : _QueryWidget()
{
m_view = tree_view_new();
- m_widget = scrolled_window_new (m_view);
+
+ GtkWidget *label = gtk_label_new_with_mnemonic ("_Statuses:");
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), m_view);
+ GtkWidget *scroll = scrolled_window_new (m_view);
+ m_widget = gtk_vbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (m_widget), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_widget), scroll, TRUE, TRUE, 0);
GtkListStore *store;
GtkTreeIter iter;
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT);
m_model = GTK_TREE_MODEL (store);
gtk_list_store_append (store, &iter);
+ if (!dynamic_sidebar)
+ gtk_list_store_set (store, &iter, 0, _("All packages"), -1);
gtk_list_store_set (store, &iter, 1, TRUE, 2, 0, -1);
gtk_list_store_append (store, &iter);
+ if (!dynamic_sidebar)
+ gtk_list_store_set (store, &iter, 0, _("Available"), -1);
gtk_list_store_set (store, &iter, 1, TRUE, 2, 1, -1);
gtk_list_store_append (store, &iter);
+ if (!dynamic_sidebar)
+ gtk_list_store_set (store, &iter, 0, _("Installed"), -1);
gtk_list_store_set (store, &iter, 1, TRUE, 2, 2, -1);
gtk_list_store_append (store, &iter);
+ if (!dynamic_sidebar)
+ gtk_list_store_set (store, &iter, 0, _("Upgrades"), -1);
gtk_list_store_set (store, &iter, 1, TRUE, 2, 3, -1);
gtk_list_store_append (store, &iter);
+ if (!dynamic_sidebar)
+ gtk_list_store_set (store, &iter, 0, _("Summary"), -1);
gtk_list_store_set (store, &iter, 1, TRUE, 2, 4, -1);
GtkTreeModel *filter_model = gtk_tree_model_filter_new (m_model, NULL);
@@ -2147,7 +2357,7 @@
list_store_set_text_count (store, &iter, _("Modified"), modifiedNb);
}
- virtual bool begsUpdate() { return true; }
+ virtual bool begsUpdate() { return dynamic_sidebar; }
virtual bool writeQuery (Ypp::PkgQuery::Query *query)
{
@@ -2194,6 +2404,9 @@
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (m_widget), vbox);
+
+ g_signal_connect (G_OBJECT (vbox), "expose-event",
+ G_CALLBACK (expose_cb), NULL);
}
void setPackage (Ypp::Package *package)
@@ -2216,37 +2429,220 @@
else
gtk_widget_hide (m_pkg_view);
}
+
+ static gboolean expose_cb (GtkWidget *widget, GdkEventExpose *event)
+ {
+ cairo_t *cr = gdk_cairo_create (widget->window);
+ GdkColor color = { 0, 255 << 8, 255 << 8, 255 << 8 };
+ gdk_cairo_set_source_color (cr, &color);
+ cairo_rectangle (cr, event->area.x, event->area.y,
+ event->area.width, event->area.height);
+ cairo_fill (cr);
+ cairo_destroy (cr);
+ return FALSE;
+ }
+};
+
+class Toolbar
+{
+GtkWidget *m_toolbar;
+GtkWidget *m_install_button, *m_upgrade_button, *m_remove_button;
+Ypp::PkgList m_packages;
+
+public:
+ GtkWidget *getWidget() { return m_toolbar; }
+
+ Toolbar (bool yast_style)
+ {
+ if (yast_style) {
+ m_toolbar = gtk_hbox_new (FALSE, 6);
+ m_install_button = gtk_button_new_with_label (_("Install"));
+ gtk_button_set_image (GTK_BUTTON (m_install_button),
+ gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON));
+ gtk_box_pack_start (GTK_BOX (m_toolbar), m_install_button, FALSE, TRUE, 0);
+ m_upgrade_button = gtk_button_new_with_label (_("Upgrade"));
+ gtk_button_set_image (GTK_BUTTON (m_upgrade_button),
+ gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON));
+ gtk_box_pack_start (GTK_BOX (m_toolbar), m_upgrade_button, FALSE, TRUE, 0);
+ m_remove_button = gtk_button_new_with_label (_("Remove"));
+ gtk_button_set_image (GTK_BUTTON (m_remove_button),
+ gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON));
+ gtk_box_pack_start (GTK_BOX (m_toolbar), m_remove_button, FALSE, TRUE, 0);
+ }
+ else {
+ m_toolbar = gtk_toolbar_new();
+ m_install_button = GTK_WIDGET (gtk_tool_button_new (
+ gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_LARGE_TOOLBAR), _("Install")));
+ gtk_tool_item_set_is_important (GTK_TOOL_ITEM (m_install_button), TRUE);
+ gtk_toolbar_insert (GTK_TOOLBAR (m_toolbar), GTK_TOOL_ITEM (m_install_button), -1);
+ m_upgrade_button = GTK_WIDGET (gtk_tool_button_new (
+ gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_LARGE_TOOLBAR), _("Upgrade")));
+ gtk_tool_item_set_is_important (GTK_TOOL_ITEM (m_upgrade_button), TRUE);
+ gtk_toolbar_insert (GTK_TOOLBAR (m_toolbar), GTK_TOOL_ITEM (m_upgrade_button), -1);
+ m_remove_button = GTK_WIDGET (gtk_tool_button_new (
+ gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_LARGE_TOOLBAR), _("Remove")));
+ gtk_tool_item_set_is_important (GTK_TOOL_ITEM (m_remove_button), TRUE);
+ gtk_toolbar_insert (GTK_TOOLBAR (m_toolbar), GTK_TOOL_ITEM (m_remove_button), -1);
+ }
+
+ g_signal_connect (G_OBJECT (m_install_button), "clicked",
+ G_CALLBACK (install_clicked_cb), this);
+ g_signal_connect (G_OBJECT (m_upgrade_button), "clicked",
+ G_CALLBACK (upgrade_clicked_cb), this);
+ g_signal_connect (G_OBJECT (m_remove_button), "clicked",
+ G_CALLBACK (remove_clicked_cb), this);
+
+ setPackages (Ypp::PkgList());
+ }
+
+ void setPackages (Ypp::PkgList list)
+ {
+ m_packages = list;
+ if (list.size() == 0) {
+ gtk_widget_set_sensitive (m_install_button, FALSE);
+ gtk_widget_set_sensitive (m_upgrade_button, FALSE);
+ gtk_widget_set_sensitive (m_remove_button, FALSE);
+ }
+ else {
+ bool installed = list.installed();
+ gtk_widget_set_sensitive (m_install_button, !installed);
+ gtk_widget_set_sensitive (m_remove_button, installed);
+ gtk_widget_set_sensitive (m_upgrade_button, list.upgradable());
+ }
+ }
+
+ static void install_clicked_cb (GtkWidget *button, Toolbar *pThis)
+ {
+ pThis->m_packages.install();
+ }
+
+ static void upgrade_clicked_cb (GtkWidget *button, Toolbar *pThis)
+ {
+ pThis->m_packages.install();
+ }
+
+ static void remove_clicked_cb (GtkWidget *button, Toolbar *pThis)
+ {
+ pThis->m_packages.remove();
+ }
};
class UI : public YGtkPackageView::Listener, _QueryListener, Ypp::Disk::Listener
{
-GtkWidget *m_widget, *m_view, *m_disk_label;
-_QueryWidget *m_query[3];
+GtkWidget *m_widget, *m_disk_label;
+YGtkPackageView *m_all_view, *m_installed_view, *m_available_view, *m_upgrades_view;
+std::list <_QueryWidget *> m_query;
DetailBox *m_details;
DiskView *m_disk;
Ypp::Package::Type m_type;
+Toolbar *m_toolbar;
public:
GtkWidget *getWidget() { return m_widget; }
UI (YPackageSelector *sel)
{
+ m_toolbar = 0;
+
if (sel->onlineUpdateMode())
m_type = Ypp::Package::PATCH_TYPE;
else if (!sel->searchMode())
m_type = Ypp::Package::PATTERN_TYPE;
else
m_type = Ypp::Package::PACKAGE_TYPE;
- YGtkPackageView *view = ygtk_package_view_new (TRUE);
- view->setListener (this);
- m_view = GTK_WIDGET (view);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view), GTK_SHADOW_IN);
+
+ m_all_view = m_installed_view = m_available_view = m_upgrades_view = NULL;
+
+ _QueryWidget *search_entry = 0;
+ if (search_entry_top)
+ search_entry = new SearchEntry (false);
+ m_query.push_back (search_entry);
+ gtk_widget_set_size_request (search_entry->getWidget(), 160, -1);
+
+ UndoView *undo_view = 0;
+ if (undo_side || undo_tab)
+ undo_view = new UndoView();
+
+ GtkWidget *packages_box;
+ if (status_tabs) {
+ m_installed_view = ygtk_package_view_new (TRUE);
+ m_installed_view->setListener (this);
+ m_available_view = ygtk_package_view_new (TRUE);
+ m_available_view->setListener (this);
+ m_upgrades_view = ygtk_package_view_new (TRUE);
+ m_upgrades_view->setListener (this);
+
+ packages_box = ygtk_notebook_new();
+ const char **labels;
+ if (status_tabs_as_actions) {
+ const char *t[] = { _("_Install"), _("_Upgrade"), _("_Remove"), _("Undo") };
+ labels = t;
+ }
+ else {
+ const char *t[] = { _("_Available"), _("_Upgrades"), _("_Installed"), _("Summary") };
+ labels = t;
+ }
+ gtk_notebook_append_page (GTK_NOTEBOOK (packages_box),
+ GTK_WIDGET (m_available_view), gtk_label_new_with_mnemonic (labels[0]));
+ gtk_notebook_append_page (GTK_NOTEBOOK (packages_box),
+ GTK_WIDGET (m_upgrades_view), gtk_label_new_with_mnemonic (labels[1]));
+ gtk_notebook_append_page (GTK_NOTEBOOK (packages_box),
+ GTK_WIDGET (m_installed_view), gtk_label_new_with_mnemonic (labels[2]));
+
+ if (undo_tab) {
+ GtkWidget *box = gtk_event_box_new();
+ gtk_container_add (GTK_CONTAINER (box), undo_view->createView (this, true));
+ gtk_container_set_border_width (GTK_CONTAINER (box), 6);
+ gtk_notebook_append_page (GTK_NOTEBOOK (packages_box),
+ box, gtk_label_new_with_mnemonic (labels[3]));
+ }
+
+ if (search_entry)
+ // FIXME: only the entry itself is shown, without the "Find:" label
+ ygtk_notebook_set_corner_widget (
+ YGTK_NOTEBOOK (packages_box), search_entry->getWidget());
+ }
+ else {
+ m_all_view = ygtk_package_view_new (TRUE);
+ m_all_view->setListener (this);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (m_all_view), GTK_SHADOW_IN);
+
+ packages_box = gtk_vbox_new (FALSE, 4);
+ GtkWidget *header_box = gtk_hbox_new (FALSE, 6);
+ GtkWidget *header = gtk_label_new_with_mnemonic (_("_Listing:"));
+ gtk_misc_set_alignment (GTK_MISC (header), 0, .5);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (header), GTK_WIDGET (m_all_view));
+ gtk_box_pack_start (GTK_BOX (header_box), header, TRUE, TRUE, 0);
+ if (search_entry)
+ gtk_box_pack_start (GTK_BOX (header_box), search_entry->getWidget(), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (packages_box), header_box, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (packages_box), GTK_WIDGET (m_all_view), TRUE, TRUE, 0);
+ }
+
+ GtkWidget *packages_button_box = gtk_vbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (packages_button_box), packages_box, TRUE, TRUE, 0);
+ if (!toolbar_top && toolbar_yast)
+ gtk_box_pack_start (GTK_BOX (packages_button_box), (m_toolbar = new Toolbar (true))->getWidget(), FALSE, TRUE, 0);
+
+ GtkWidget *packages_pane = gtk_hpaned_new();
+ gtk_paned_pack1 (GTK_PANED (packages_pane), packages_button_box, TRUE, FALSE);
+ GtkWidget *undo_widget;
+ if (undo_side) {
+ if (undo_old_style)
+ undo_widget = (new ChangesPane())->getWidget();
+ else
+ undo_widget = undo_view->createView (this, false);
+ gtk_paned_pack2 (GTK_PANED (packages_pane), undo_widget, FALSE, FALSE);
+ gtk_paned_set_position (GTK_PANED (packages_pane), 350);
+ }
GtkWidget *view_pane = gtk_vpaned_new();
- gtk_paned_pack1 (GTK_PANED (view_pane), m_view, TRUE, FALSE);
+ gtk_paned_pack1 (GTK_PANED (view_pane), packages_pane, TRUE, FALSE);
m_details = new DetailBox();
gtk_paned_pack2 (GTK_PANED (view_pane), m_details->getWidget(), FALSE, TRUE);
+ gtk_paned_set_position (GTK_PANED (view_pane), 500);
+#if 0
GtkWidget *combo = gtk_combo_box_new_text();
if (sel->onlineUpdateMode()) {
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Patch"));
@@ -2275,40 +2671,65 @@
GtkWidget *view_vbox = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (view_vbox), view_pane, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (view_vbox), type_hbox, FALSE, TRUE, 0);
-
+#endif
GtkWidget *side_vbox = gtk_vbox_new (FALSE, 12);
- m_query[0] = new SearchEntry();
- gtk_box_pack_start (GTK_BOX (side_vbox), m_query[0]->getWidget(), FALSE, TRUE, 0);
+ if (search_entry_side) {
+ _QueryWidget *search_entry = new SearchEntry (true);
+ m_query.push_back (search_entry);
+ gtk_box_pack_start (GTK_BOX (side_vbox), search_entry->getWidget(), FALSE, TRUE, 0);
+ }
- m_query[1] = new CategoryView();
- m_query[2] = new StatusView();
+ _QueryWidget *categories = new CategoryView();
+ m_query.push_back (categories);
GtkWidget *cat_pane = gtk_vpaned_new();
- gtk_paned_pack1 (GTK_PANED (cat_pane), m_query[1]->getWidget(), TRUE, FALSE);
- gtk_paned_pack2 (GTK_PANED (cat_pane), m_query[2]->getWidget(), TRUE, FALSE);
+ gtk_paned_pack1 (GTK_PANED (cat_pane), categories->getWidget(), TRUE, FALSE);
+ if (status_side) {
+ _QueryWidget *statuses = new StatusView();
+ m_query.push_back (statuses);
+ gtk_paned_pack2 (GTK_PANED (cat_pane), statuses->getWidget(), TRUE, FALSE);
+ }
gtk_box_pack_start (GTK_BOX (side_vbox), cat_pane, TRUE, TRUE, 0);
GtkWidget *side_pane = gtk_hpaned_new();
- gtk_paned_pack1 (GTK_PANED (side_pane), side_vbox, FALSE, FALSE);
- gtk_paned_pack2 (GTK_PANED (side_pane), view_vbox, TRUE, FALSE);
+ gtk_paned_pack1 (GTK_PANED (side_pane), side_vbox, FALSE, TRUE);
+ gtk_paned_pack2 (GTK_PANED (side_pane), view_pane, TRUE, FALSE);
gtk_paned_set_position (GTK_PANED (side_pane), 150);
- for (int i = 0; i < 3; i++) {
- m_query[i]->updateType (m_type);
- m_query[i]->setListener (this);
+ for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
+ it != m_query.end(); it++) {
+ (*it)->updateType (m_type);
+ (*it)->setListener (this);
}
refresh();
updateDisk();
Ypp::get()->getDisk()->addListener (this);
- m_widget = side_pane;
+
+ if (toolbar_top) {
+ m_toolbar = new Toolbar (false);
+ m_widget = gtk_vbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (m_widget), m_toolbar->getWidget(), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_widget), side_pane, TRUE, TRUE, 0);
+ }
+ else
+ m_widget = side_pane;
+
gtk_widget_show_all (m_widget);
- gtk_widget_hide (m_details->getWidget());
+
+ if (details_start_hide) {
+ gtk_widget_hide (m_details->getWidget());
+ if (undo_old_style)
+ gtk_widget_hide (undo_widget);
+ }
+ else
+ m_details->setPackage (NULL);
}
~UI()
{
- for (int i = 0; i < 3; i++)
- delete m_query[i];
+ for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
+ it != m_query.end(); it++)
+ delete *it;
delete m_disk;
}
@@ -2316,10 +2737,11 @@
void updateWidget (_QueryWidget *widget)
{
Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
- for (int i = 0; i < 3; i++) {
- if (m_query[i] == widget)
+ for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
+ it != m_query.end(); it++) {
+ if (*it == widget)
continue;
- m_query[i]->writeQuery (query);
+ (*it)->writeQuery (query);
}
Ypp::PkgQuery list (m_type, query);
@@ -2328,30 +2750,53 @@
virtual void refresh()
{
- bool widgetModified[3] = { false };
Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
- for (int i = 0; i < 3; i++)
- widgetModified[i] = m_query[i]->writeQuery (query);
+ for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
+ it != m_query.end(); it++)
+ (*it)->modified = (*it)->writeQuery (query);
Ypp::PkgQuery list (m_type, query);
- ((YGtkPackageView *) m_view)->setList (list, NULL);
+ if (m_all_view)
+ m_all_view->setList (list, NULL);
+
+ if (m_installed_view) {
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ query->setIsInstalled (true);
+ Ypp::PkgQuery _list (list, query);
+ m_installed_view->setList (_list, NULL);
+ }
+ if (m_available_view) {
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ query->setIsInstalled (false);
+ Ypp::PkgQuery _list (list, query);
+ m_available_view->setList (_list, NULL);
+ }
+ if (m_upgrades_view) {
+ Ypp::PkgQuery::Query *query = new Ypp::PkgQuery::Query();
+ query->setHasUpgrade (true);
+ Ypp::PkgQuery _list (list, query);
+ m_upgrades_view->setList (_list, NULL);
+ }
- for (int i = 0; i < 3; i++)
- if (m_query[i]->begsUpdate()) {
- if (widgetModified[i])
- updateWidget (m_query[i]);
+ for (std::list <_QueryWidget *>::const_iterator it = m_query.begin();
+ it != m_query.end(); it++)
+ if ((*it)->begsUpdate()) {
+ if ((*it)->modified)
+ updateWidget (*it);
else
- m_query[i]->updateList (list);
+ (*it)->updateList (list);
}
}
virtual void packagesSelected (Ypp::PkgList packages)
{
m_details->setPackage (packages.size() ? packages.get (0) : NULL);
+ m_toolbar->setPackages (packages);
}
virtual void updateDisk()
{
+#if 0
Ypp::Disk *disk = Ypp::get()->getDisk();
const Ypp::Disk::Partition *part = 0;
for (int i = 0; disk->getPartition (i); i++) {
@@ -2375,13 +2820,15 @@
}
else
gtk_label_set_text (GTK_LABEL (m_disk_label), "");
+#endif
}
static void type_changed_cb (GtkComboBox *combo, UI *pThis)
{
pThis->m_type = (Ypp::Package::Type) gtk_combo_box_get_active (combo);
- for (int i = 0; i < 3; i++)
- pThis->m_query[i]->updateType (pThis->m_type);
+ for (std::list <_QueryWidget *>::const_iterator it = pThis->m_query.begin();
+ it != pThis->m_query.end(); it++)
+ (*it)->updateType (pThis->m_type);
pThis->refresh();
}
};
@@ -2425,8 +2872,10 @@
G_CALLBACK (wizard_action_cb), this);
ygtk_wizard_enable_button (wizard, wizard->next_button, FALSE);
+#if 0
m_tools = new ToolsBox();
ygtk_wizard_set_extra_button (YGTK_WIZARD (getWidget()), m_tools->getWidget());
+#endif
m_progressbar = gtk_progress_bar_new();
GtkWidget *empty = gtk_event_box_new();
@@ -2462,7 +2911,9 @@
if (m_button_timeout_id)
g_source_remove (m_button_timeout_id);
// delete m_notebook;
+#if 0
delete m_tools;
+#endif
Ypp::finish();
}
Modified: trunk/gtk/src/pkg/ygtknotebook.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtknotebook.c?rev=6…
==============================================================================
--- trunk/gtk/src/pkg/ygtknotebook.c (original)
+++ trunk/gtk/src/pkg/ygtknotebook.c Thu Dec 24 16:17:46 2009
@@ -88,11 +88,8 @@
{
GTK_WIDGET_CLASS (ygtk_notebook_parent_class)->map (widget);
YGtkNotebook *notebook = YGTK_NOTEBOOK (widget);
- if (notebook->corner_widget) {
- GtkWidget *corner = notebook->corner_widget;
- if (corner && GTK_WIDGET_VISIBLE (corner) && !GTK_WIDGET_MAPPED (corner))
- gtk_widget_map (corner);
- }
+ if (notebook->corner_widget)
+ gtk_widget_map (notebook->corner_widget);
}
static void ygtk_notebook_switch_page (
Modified: trunk/gtk/src/pkg/ygtkpackageview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpackageview.cc?r…
==============================================================================
--- trunk/gtk/src/pkg/ygtkpackageview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpackageview.cc Thu Dec 24 16:17:46 2009
@@ -19,6 +19,9 @@
#include <gtk/gtk.h>
#include <string.h>
+extern bool status_col, action_col, action_col_as_button, action_col_as_check,
+ version_col, single_line_rows;
+
//** Icons resources
struct PackageIcons {
@@ -640,7 +643,6 @@
bool visibleDefault, allowHide, sortable;
};
static const Column columns[] = {
- { NULL, "to-install", true, false, false },
{ "Name", "name", true, false, true },
{ "Version", "available-version", true, true, false },
{ "Repository", "repository", false, true, false },
@@ -652,8 +654,7 @@
static Property translateProperty (const std::string &prop)
{
if (prop == "name")
-// return NAME_PROP;
- return NAME_SUMMARY_PROP;
+ return single_line_rows ? NAME_PROP : NAME_SUMMARY_PROP;
if (prop == "available-version")
return AVAILABLE_VERSION_PROP;
if (prop == "repository")
@@ -701,13 +702,22 @@
gtk_widget_show_all (scroll);
clear();
+ if (action_col) {
+ if (action_col_as_button)
+ appendButtonColumn (NULL, "to-install");
+ else // if (action_col_as_check)
+ appendCheckColumn ("to-install");
+ }
+ if (status_col)
+ appendIconColumn (NULL, "icon");
+
for (int i = 0; i < columns_size; i++) {
const Column *column = &columns[i];
- if (column->prop.compare (0, 3, "to-") == 0)
- appendButtonColumn (column->header, column->prop);
- else
- appendTextColumn (column->header, column->prop,
- column->visibleDefault, column->sortable);
+ bool visible = column->visibleDefault;
+ if (column->prop == "available-version")
+ visible = version_col;
+ appendTextColumn (column->header, column->prop,
+ visible, column->sortable);
}
}
@@ -802,9 +812,12 @@
GtkTreeViewColumn *getColumn (const std::string &property)
{
- for (int i = 0; i < columns_size; i++)
- if (columns[i].prop == property)
- return gtk_tree_view_get_column (GTK_TREE_VIEW (m_view), i);
+ GList *columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (m_view));
+ for (GList *i = columns; i; i = i->next) {
+ gchar *col_prop = (gchar *) g_object_get_data (G_OBJECT (i->data), "property");
+ if (col_prop && property == col_prop)
+ return (GtkTreeViewColumn *) i->data;
+ }
return NULL;
}
@@ -820,8 +833,9 @@
bool isVisible (const std::string &property)
{ return gtk_tree_view_column_get_visible (getColumn (property)); }
- void appendIconColumn (const char *header, int col)
+ void appendIconColumn (const char *header, const std::string &prop)
{
+ int col = ICON_PROP; // 'prop' is ignored
GtkTreeView *view = GTK_TREE_VIEW (m_view);
if (header)
gtk_tree_view_set_headers_visible (view, TRUE);
@@ -897,7 +911,9 @@
"visible", CHECK_VISIBLE_PROP,
"sensitive", SENSITIVE_PROP,
"cell-background", BACKGROUND_PROP,
- "text", labelCol, "stock-id", stockCol, NULL);
+ "text", labelCol,
+// "stock-id", stockCol,
+ NULL);
g_signal_connect (G_OBJECT (renderer), "toggled",
G_CALLBACK (renderer_toggled_cb), this);
@@ -910,7 +926,8 @@
width = MAX (width, rect.width);
g_object_unref (G_OBJECT (layout));
}
- width += 36;
+ width += 16;
+// width += 20; // icon
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width (column, width);
Modified: trunk/gtk/src/ygtkfindentry.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfindentry.c?rev=6019…
==============================================================================
--- trunk/gtk/src/ygtkfindentry.c (original)
+++ trunk/gtk/src/ygtkfindentry.c Thu Dec 24 16:17:46 2009
@@ -30,6 +30,7 @@
static void ygtk_ext_entry_map (GtkWidget *widget)
{
+fprintf (stderr, "ext entry - map\n");
if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget)) {
GTK_WIDGET_CLASS (ygtk_ext_entry_parent_class)->map (widget);
YGtkExtEntry *entry = YGTK_EXT_ENTRY (widget);
@@ -42,6 +43,7 @@
static void ygtk_ext_entry_unmap (GtkWidget *widget)
{
+fprintf (stderr, "ext entry - unmap\n");
if (GTK_WIDGET_MAPPED (widget)) {
YGtkExtEntry *entry = YGTK_EXT_ENTRY (widget);
if (entry->left_window)
@@ -328,6 +330,7 @@
static void ygtk_find_entry_realize (GtkWidget *widget)
{
+fprintf (stderr, "find entry - realize\n");
GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->realize (widget);
YGtkExtEntry *eentry = YGTK_EXT_ENTRY (widget);
@@ -348,6 +351,7 @@
static void ygtk_find_entry_unrealize (GtkWidget *widget)
{
+fprintf (stderr, "find entry - unrealize\n");
GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->unrealize (widget);
YGtkFindEntry *fentry = YGTK_FIND_ENTRY (widget);
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r60194 - /branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc
by aschnell@svn.opensuse.org 23 Dec '09
by aschnell@svn.opensuse.org 23 Dec '09
23 Dec '09
Author: aschnell
Date: Wed Dec 23 15:56:07 2009
New Revision: 60194
URL: http://svn.opensuse.org/viewcvs/yast?rev=60194&view=rev
Log:
- use newer logging macros
Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/stora…
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/MdPartCo.cc Wed Dec 23 15:56:07 2009
@@ -158,8 +158,7 @@
string& device,
bool checkRelaxed )
{
- y2milestone( "begin type %d at %ld len %ld relaxed:%d", type, start, len,
- checkRelaxed );
+ y2mil("begin type:" << type << " start:" << start << " len:" << len << " relaxed:" << checkRelaxed);
int ret = disk ? 0 : MDPART_INTERNAL_ERR;
if( ret==0 && readonly() )
ret = MDPART_CHANGE_READONLY;
@@ -178,7 +177,7 @@
int
MdPartCo::createPartition( long unsigned len, string& device, bool checkRelaxed )
{
- y2milestone( "len %ld relaxed:%d", len, checkRelaxed );
+ y2mil("len:" << len << " relaxed:" << checkRelaxed);
int ret = disk ? 0 : MDPART_INTERNAL_ERR;
if( ret==0 && readonly() )
ret = MDPART_CHANGE_READONLY;
@@ -193,7 +192,7 @@
int
MdPartCo::createPartition( storage::PartitionType type, string& device )
{
- y2milestone( "type %u", type );
+ y2mil("type:" << type);
int ret = disk ? 0 : MDPART_INTERNAL_ERR;
if( ret==0 && readonly() )
ret = MDPART_CHANGE_READONLY;
@@ -401,7 +400,7 @@
void MdPartCo::handleWholeDevice()
{
Disk::PartPair pp = disk->partPair( Partition::notDeleted );
- y2milestone( "empty:%d", pp.empty() );
+ y2mil("empty:" << pp.empty());
if( pp.empty() )
{
@@ -517,7 +516,7 @@
int MdPartCo::destroyPartitionTable( const string& new_label )
{
- y2milestone( "begin" );
+ y2mil("begin");
int ret = disk->destroyPartitionTable( new_label );
if( ret==0 )
{
@@ -621,8 +620,7 @@
int MdPartCo::doSetType( MdPart* md )
{
- y2milestone( "doSetType container %s name %s", name().c_str(),
- md->name().c_str() );
+ y2mil("doSetType container:" << name() << " name:" << md->name());
Partition * p = md->getPtr();
int ret = p?0:MDPART_PARTITION_NOT_FOUND;
if( ret==0 )
@@ -639,7 +637,7 @@
int MdPartCo::doCreateLabel()
{
- y2milestone( "label:%s", labelName().c_str() );
+ y2mil("label:" << labelName());
int ret = 0;
if( !silent )
{
@@ -663,7 +661,7 @@
MdPartCo::removeMdPart()
{
int ret = 0;
- y2milestone( "begin" );
+ y2mil("begin");
if( readonly() )
{
ret = MDPART_CHANGE_READONLY;
@@ -739,7 +737,7 @@
list<Volume*>& vol )
{
int ret = 0;
- y2milestone( "ret:%d col:%zd vol:%zd", ret, col.size(), vol.size());
+ y2mil("ret:" << ret << " col:" << col.size() << " << vol:" << vol.size());
getStorage()->logCo( this );
unsigned long oco = col.size();
unsigned long ovo = vol.size();
@@ -754,14 +752,14 @@
if( del_ptable && find( col.begin(), col.end(), this )==col.end() )
col.push_back( this );
if( col.size()!=oco || vol.size()!=ovo )
- y2milestone( "ret:%d col:%zd vol:%zd", ret, col.size(), vol.size());
+ y2mil("ret:" << ret << " col:" << col.size() << " vol:" << vol.size());
return( ret );
}
int MdPartCo::commitChanges( CommitStage stage, Volume* vol )
{
- y2milestone( "name %s stage %d", name().c_str(), stage );
+ y2mil("name:" << name() << " stage:" << stage);
int ret = Container::commitChanges( stage, vol );
if( ret==0 && stage==INCREASE )
{
@@ -781,7 +779,7 @@
int MdPartCo::commitChanges( CommitStage stage )
{
- y2milestone( "name %s stage %d", name().c_str(), stage );
+ y2mil("name:" << name() << " stage:" << stage);
int ret = 0;
if( stage==DECREASE && deleted() )
{
@@ -826,7 +824,7 @@
int
MdPartCo::doCreate( Volume* v )
{
- y2milestone( "Raid:%s part:%s", name().c_str(), v->name().c_str() );
+ y2mil("name:" << name() << " v->name:" << v->name());
MdPart * l = dynamic_cast<MdPart *>(v);
int ret = disk ? 0 : MDPART_INTERNAL_ERR;
if( ret==0 && l == NULL )
@@ -871,7 +869,7 @@
int MdPartCo::doRemove( Volume* v )
{
- y2milestone( "Raid:%s name:%s", name().c_str(), v->name().c_str() );
+ y2mil("name:" << name() << " v->name:" << v->name());
MdPart * l = dynamic_cast<MdPart *>(v);
bool save_act = false;
int ret = disk ? 0 : MDPART_INTERNAL_ERR;
@@ -914,7 +912,7 @@
int MdPartCo::doResize( Volume* v )
{
- y2milestone( "MdPart:%s name:%s", name().c_str(), v->name().c_str() );
+ y2mil("name:" << name() << " v->name:" << v->name());
MdPart * l = dynamic_cast<MdPart *>(v);
int ret = disk ? 0 : MDPART_INTERNAL_ERR;
if( ret==0 && l == NULL )
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
23 Dec '09
Author: jsmeix
Date: Wed Dec 23 15:50:02 2009
New Revision: 60193
URL: http://svn.opensuse.org/viewcvs/yast?rev=60193&view=rev
Log:
Fixed yast2-scanner.spec.in (removed Duplicate
License and RPM Group and added %changelog tag).
Modified:
trunk/scanner/yast2-scanner.spec.in
Modified: trunk/scanner/yast2-scanner.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/scanner/yast2-scanner.spec.in?re…
==============================================================================
--- trunk/scanner/yast2-scanner.spec.in (original)
+++ trunk/scanner/yast2-scanner.spec.in Wed Dec 23 15:50:02 2009
@@ -2,8 +2,6 @@
@HEADER@
-Group: System/YaST
-License: GPL v2 or later
BuildRequires: docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer sgml-skel update-desktop-files xorg-x11-libX11-devel yast2 yast2-devtools yast2-testsuite
Requires: yast2
# Used to exclude libX11, libXau, libxcb, and libxcb-xlib from the requires list
@@ -49,3 +47,6 @@
@ybindir@/*scanner*
@ybindir@/displaytest
%doc @docdir@
+
+%changelog
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0