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 2007
- 21 participants
- 683 discussions
Author: rpmcruz
Date: Fri Dec 21 10:20:11 2007
New Revision: 43219
URL: http://svn.opensuse.org/viewcvs/yast?rev=43219&view=rev
Log:
Moving unstable-libyui to main.
Removed:
trunk/gtk/src/icons/cat-development.xpm
trunk/gtk/src/icons/cat-documentation.xpm
trunk/gtk/src/icons/cat-emulators.xpm
trunk/gtk/src/icons/cat-games.xpm
trunk/gtk/src/icons/cat-hardware.xpm
trunk/gtk/src/icons/cat-multimedia.xpm
trunk/gtk/src/icons/cat-network.xpm
trunk/gtk/src/icons/cat-office.xpm
trunk/gtk/src/icons/cat-system.xpm
trunk/gtk/src/icons/cat-utilities.xpm
trunk/gtk/src/icons/pkg-3D.xpm
Modified:
trunk/gtk/src/icons/pkg-list-mode.xpm
trunk/gtk/src/icons/pkg-tiles-mode.xpm
Modified: trunk/gtk/src/icons/pkg-list-mode.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-list-mode.xpm?…
==============================================================================
--- trunk/gtk/src/icons/pkg-list-mode.xpm (original)
+++ trunk/gtk/src/icons/pkg-list-mode.xpm Fri Dec 21 10:20:11 2007
@@ -1,22 +1,13 @@
/* XPM */
static const char * pkg_list_mode_xpm[] = {
-"16 16 3 1",
+"8 8 2 1",
" c None",
". c #000000",
-"+ c #707070",
-" ",
-" ......... ",
-" +++++++++ ",
-" ",
-" ",
-" ............ ",
-" ++++++++++++ ",
-" ",
-" ",
-" ......... ",
-" +++++++++ ",
-" ",
-" ",
-" ............ ",
-" ++++++++++++ ",
-" "};
+" ",
+"........",
+" ",
+" ",
+"...... ",
+" ",
+" ",
+"........"};
Modified: trunk/gtk/src/icons/pkg-tiles-mode.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-tiles-mode.xpm…
==============================================================================
--- trunk/gtk/src/icons/pkg-tiles-mode.xpm (original)
+++ trunk/gtk/src/icons/pkg-tiles-mode.xpm Fri Dec 21 10:20:11 2007
@@ -1,22 +1,13 @@
/* XPM */
static const char * pkg_tiles_mode_xpm[] = {
-"16 16 3 1",
+"8 8 2 1",
" c None",
". c #000000",
-"+ c #707070",
-" ",
-" ...... ...... ",
-" .++++.+ .++++.+",
-" .+ .+ .+ .+",
-" .+ .+ .+ .+",
-" .+ .+ .+ .+",
-" ......+ ......+",
-" ++++++ ++++++",
-" ",
-" ...... ...... ",
-" .++++.+ .++++.+",
-" .+ .+ .+ .+",
-" .+ .+ .+ .+",
-" .+ .+ .+ .+",
-" ......+ ......+",
-" ++++++ ++++++"};
+" ",
+" .. .. ",
+" .. .. ",
+" ",
+" ",
+" .. .. ",
+" .. .. ",
+" "};
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
20 Dec '07
Author: rpmcruz
Date: Thu Dec 20 21:46:31 2007
New Revision: 43218
URL: http://svn.opensuse.org/viewcvs/yast?rev=43218&view=rev
Log:
Moving unstable-libyui to main.
Removed:
trunk/gtk/src/computer.xpm
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
Author: rpmcruz
Date: Thu Dec 20 21:46:07 2007
New Revision: 43217
URL: http://svn.opensuse.org/viewcvs/yast?rev=43217&view=rev
Log:
Moving unstable-libyui to main.
Added:
trunk/gtk/src/YGInputField.cc
trunk/gtk/src/YGSelectionModel.cc
trunk/gtk/src/YGSelectionModel.h
trunk/gtk/src/ygtkcellrenderertextpixbuf.c
trunk/gtk/src/ygtkcellrenderertextpixbuf.h
trunk/gtk/src/ygtkscrolledwindow.c
trunk/gtk/src/ygtkscrolledwindow.h
trunk/gtk/src/ygtktogglebutton.c
trunk/gtk/src/ygtktogglebutton.h
Added: trunk/gtk/src/YGInputField.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGInputField.cc?rev=4321…
==============================================================================
--- trunk/gtk/src/YGInputField.cc (added)
+++ trunk/gtk/src/YGInputField.cc Thu Dec 20 21:46:07 2007
@@ -0,0 +1,284 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include <config.h>
+#include <ycp/y2log.h>
+#include <YGUI.h>
+#include "YInputField.h"
+#include "YGWidget.h"
+#include "YGUtils.h"
+#include "ygtkfieldentry.h"
+
+class YGInputField : public YInputField, public YGLabeledWidget
+{
+public:
+ YGInputField (YWidget *parent, const string &label, bool passwordMode)
+ : YInputField (NULL, label, passwordMode),
+ YGLabeledWidget (this, parent, label, YD_HORIZ, true,
+ YGTK_TYPE_FIELD_ENTRY, NULL)
+ {
+ YGtkFieldEntry *field = YGTK_FIELD_ENTRY (getWidget());
+ ygtk_field_entry_add_field (field, 0);
+
+ GtkEntry *entry = ygtk_field_entry_get_field_widget (field, 0);
+ gtk_entry_set_activates_default (entry, TRUE);
+ if (passwordMode)
+ gtk_entry_set_visibility (entry, FALSE);
+
+ g_signal_connect (G_OBJECT (getWidget()), "field-entry-changed",
+ G_CALLBACK (value_changed_cb), this);
+ }
+
+ // YInputField
+ virtual string value()
+ {
+ YGtkFieldEntry *field = YGTK_FIELD_ENTRY (getWidget());
+ return ygtk_field_entry_get_field_text (field, 0);
+ }
+
+ virtual void setValue (const string &text)
+ {
+ YGtkFieldEntry *field = YGTK_FIELD_ENTRY (getWidget());
+ ygtk_field_entry_set_field_text (field, 0, text.c_str());
+ }
+
+ void updateProps()
+ {
+ YGtkFieldEntry *field = YGTK_FIELD_ENTRY (getWidget());
+ ygtk_field_entry_setup_field (field, 0, inputMaxLength(), validChars().c_str());
+ }
+
+ virtual void setInputMaxLength (int len)
+ {
+ YInputField::setInputMaxLength (len);
+ updateProps();
+ }
+
+ virtual void setValidChars (const string &validChars)
+ {
+ YInputField::setValidChars (validChars);
+ updateProps();
+ }
+
+ static void value_changed_cb (YGtkFieldEntry *entry, gint field_nb, YGInputField *pThis)
+ {
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YInputField)
+};
+
+YInputField *YGWidgetFactory::createInputField (YWidget *parent, const string &label,
+ bool passwordMode)
+{
+ return new YGInputField (parent, label, passwordMode);
+}
+
+#include "YTimeField.h"
+
+class YGTimeField : public YTimeField, public YGLabeledWidget
+{
+public:
+ YGTimeField (YWidget *parent, const string &label)
+ : YTimeField (NULL, label),
+ YGLabeledWidget (this, parent, label, YD_HORIZ, true,
+ YGTK_TYPE_FIELD_ENTRY, NULL)
+ {
+ IMPL
+ YGtkFieldEntry *field = YGTK_FIELD_ENTRY (getWidget());
+ ygtk_field_entry_add_field (field, ':');
+ ygtk_field_entry_add_field (field, ':');
+ ygtk_field_entry_setup_field (field, 0, 2, "0123456789");
+ ygtk_field_entry_setup_field (field, 1, 2, "0123456789");
+
+ g_signal_connect (G_OBJECT (getWidget()), "field-entry-changed",
+ G_CALLBACK (value_changed_cb), this);
+ }
+
+ // YTimeField
+ virtual void setValue (const string &time)
+ {
+ IMPL
+ char hours[3], mins[3];
+ sscanf (time.c_str(), "%2s:%2s", hours, mins);
+
+ YGtkFieldEntry *entry = YGTK_FIELD_ENTRY (getWidget());
+ ygtk_field_entry_set_field_text (entry, 0, hours);
+ ygtk_field_entry_set_field_text (entry, 1, mins);
+ }
+
+ virtual string value()
+ {
+ IMPL
+ const gchar *hours, *mins;
+ YGtkFieldEntry *entry = YGTK_FIELD_ENTRY (getWidget());
+ hours = ygtk_field_entry_get_field_text (entry, 0);
+ mins = ygtk_field_entry_get_field_text (entry, 1);
+
+ gchar *time = g_strdup_printf ("%02d:%02d:00", atoi (hours), atoi (mins));
+ string str (time);
+ g_free (time);
+ return str;
+ }
+
+ // callbacks
+ static void value_changed_cb (YGtkFieldEntry *entry, gint field_nb,
+ YGTimeField *pThis)
+ { IMPL; pThis->emitEvent (YEvent::ValueChanged); }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YTimeField)
+};
+
+YTimeField *YGOptionalWidgetFactory::createTimeField (YWidget *parent, const string &label)
+{
+ IMPL
+ return new YGTimeField (parent, label);
+}
+
+#include "YDateField.h"
+#include "ygtkmenubutton.h"
+
+class YGDateField : public YDateField, public YGLabeledWidget
+{
+GtkWidget *m_calendar, *m_popup_calendar;
+
+public:
+ YGDateField (YWidget *parent, const string &label)
+ : YDateField (NULL, label),
+ YGLabeledWidget (this, parent, label, YD_HORIZ, true, YGTK_TYPE_FIELD_ENTRY, NULL)
+ {
+ IMPL
+ ygtk_field_entry_add_field (getField(), '-');
+ ygtk_field_entry_add_field (getField(), '-');
+ ygtk_field_entry_add_field (getField(), '-');
+ ygtk_field_entry_setup_field (getField(), 0, 4, "0123456789");
+ ygtk_field_entry_setup_field (getField(), 1, 2, "0123456789");
+ ygtk_field_entry_setup_field (getField(), 2, 2, "0123456789");
+
+ m_calendar = gtk_calendar_new();
+ gtk_widget_show (m_calendar);
+ GtkWidget *popup = ygtk_popup_window_new (m_calendar);
+
+ GtkWidget *menu_button = ygtk_menu_button_new();
+ ygtk_menu_button_set_popup (YGTK_MENU_BUTTON (menu_button), popup);
+ gtk_widget_show (menu_button);
+ gtk_box_pack_start (GTK_BOX (getWidget()), menu_button, FALSE, TRUE, 6);
+
+ g_signal_connect (G_OBJECT (getField()), "field-entry-changed",
+ G_CALLBACK (value_changed_cb), this);
+
+ g_signal_connect (G_OBJECT (m_calendar), "day-selected",
+ G_CALLBACK (calendar_changed_cb), this);
+ g_signal_connect (G_OBJECT (m_calendar), "day-selected-double-click",
+ G_CALLBACK (double_click_cb), popup);
+ }
+
+ inline GtkCalendar *getCalendar()
+ { return GTK_CALENDAR (m_calendar); }
+ inline YGtkFieldEntry *getField()
+ { return YGTK_FIELD_ENTRY (getWidget()); }
+
+ // YDateField
+ virtual void setValue (const string &date)
+ {
+ IMPL
+ char year[5], month[3], day[3];
+ sscanf (date.c_str(), "%4s-%2s-%2s", year, month, day);
+
+ gtk_calendar_select_month (getCalendar(), atoi (month)-1, atoi (year));
+ gtk_calendar_select_day (getCalendar(), atoi (day));
+
+ ygtk_field_entry_set_field_text (getField(), 0, year);
+ ygtk_field_entry_set_field_text (getField(), 1, month);
+ ygtk_field_entry_set_field_text (getField(), 2, day);
+ }
+
+ virtual string value()
+ {
+ IMPL
+ const gchar *year, *month, *day;
+ year = ygtk_field_entry_get_field_text (getField(), 0);
+ month = ygtk_field_entry_get_field_text (getField(), 1);
+ day = ygtk_field_entry_get_field_text (getField(), 2);
+
+ gchar *time = g_strdup_printf ("%04d-%02d-%02d", atoi (year),
+ atoi (month), atoi (day));
+ string str (time);
+ g_free (time);
+ return str;
+ }
+
+ // callbacks
+ static void value_changed_cb (YGtkFieldEntry *entry, gint field_nb,
+ YGDateField *pThis)
+ {
+ IMPL
+ int year, month, day;
+ year = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 0));
+ month = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 1));
+ day = atoi (ygtk_field_entry_get_field_text (pThis->getField(), 2));
+
+ if (day < 1 || day > 31 || month < 1 || month > 12)
+ return; // avoid GtkCalendar warnings
+
+ g_signal_handlers_block_by_func (pThis->getCalendar(),
+ (gpointer) calendar_changed_cb, pThis);
+
+ gtk_calendar_select_month (pThis->getCalendar(), month-1, year);
+ gtk_calendar_select_day (pThis->getCalendar(), day);
+
+ g_signal_handlers_unblock_by_func (pThis->getCalendar(),
+ (gpointer) calendar_changed_cb, pThis);
+
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ static void calendar_changed_cb (GtkCalendar *calendar, YGDateField *pThis)
+ {
+ IMPL
+ guint year, month, day;
+ gtk_calendar_get_date (calendar, &year, &month, &day);
+ month += 1; // GTK calendar months go from 0 to 11
+
+ gchar *year_str, *month_str, *day_str;
+ year_str = g_strdup_printf ("%d", year);
+ month_str = g_strdup_printf ("%d", month);
+ day_str = g_strdup_printf ("%d", day);
+
+ g_signal_handlers_block_by_func (pThis->getField(),
+ (gpointer) value_changed_cb, pThis);
+
+ YGtkFieldEntry *entry = pThis->getField();
+ ygtk_field_entry_set_field_text (entry, 0, year_str);
+ ygtk_field_entry_set_field_text (entry, 1, month_str);
+ ygtk_field_entry_set_field_text (entry, 2, day_str);
+
+ g_signal_handlers_unblock_by_func (pThis->getField(),
+ (gpointer) value_changed_cb, pThis);
+
+ g_free (year_str);
+ g_free (month_str);
+ g_free (day_str);
+
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ static void double_click_cb (GtkCalendar *calendar, YGtkPopupWindow *popup)
+ {
+ // close popup
+ gtk_widget_hide (GTK_WIDGET (popup));
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YDateField)
+};
+
+YDateField *YGOptionalWidgetFactory::createDateField (YWidget *parent, const string &label)
+{
+ IMPL
+ return new YGDateField (parent, label);
+}
+
Added: trunk/gtk/src/YGSelectionModel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.cc?rev=…
==============================================================================
--- trunk/gtk/src/YGSelectionModel.cc (added)
+++ trunk/gtk/src/YGSelectionModel.cc Thu Dec 20 21:46:07 2007
@@ -0,0 +1,179 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include <config.h>
+#include <ycp/y2log.h>
+#include <gtk/gtk.h>
+#include <YTreeItem.h>
+#include "YGSelectionModel.h"
+#include "YGUtils.h"
+
+YGSelectionModel::YGSelectionModel (YSelectionWidget *ywidget, bool ordinaryModel, bool isTree)
+ : isTree (isTree), ywidget (ywidget)
+{
+ if (ordinaryModel) {
+ vector <GType> cols;
+ cols.push_back (G_TYPE_STRING);
+ cols.push_back (GDK_TYPE_PIXBUF);
+ createModel (cols);
+ }
+}
+
+YGSelectionModel::~YGSelectionModel()
+{ g_object_unref (G_OBJECT (m_model)); }
+
+void YGSelectionModel::createModel (const vector <GType> &types)
+{
+ int colsNb = types.size()+1;
+ GType types_array [colsNb];
+ int i = 0;
+ for (vector <GType>::const_iterator it = types.begin(); it != types.end(); it++)
+ types_array [i++] = *it;
+ types_array[colsNb-1] = G_TYPE_POINTER;
+
+ if (isTree)
+ m_model = GTK_TREE_MODEL (gtk_tree_store_newv (colsNb, types_array));
+ else
+ m_model = GTK_TREE_MODEL (gtk_list_store_newv (colsNb, types_array));
+}
+
+GtkTreeModel *YGSelectionModel::getModel()
+{ return m_model; }
+GtkListStore *YGSelectionModel::getListStore()
+{ return m_model ? GTK_LIST_STORE (m_model) : NULL; }
+GtkTreeStore *YGSelectionModel::getTreeStore()
+{ return m_model ? GTK_TREE_STORE (m_model) : NULL; }
+
+bool YGSelectionModel::isEmpty()
+{
+ GtkTreeIter iter;
+ return !gtk_tree_model_get_iter_first (getModel(), &iter);
+}
+
+void YGSelectionModel::doAddItem (YItem *item)
+{
+ GtkTreeIter iter;
+ addRow (&iter, item);
+ setCellLabel (&iter, LABEL_COLUMN, item->label());
+ setCellIcon (&iter, ICON_COLUMN, item->iconName());
+ for (YItemIterator it = item->childrenBegin(); it != item->childrenEnd(); it++)
+ doAddItem (*it);
+}
+
+void YGSelectionModel::doDeleteAllItems()
+{
+ if (isTree)
+ gtk_tree_store_clear (getTreeStore());
+ else
+ gtk_list_store_clear (getListStore());
+}
+
+YItem *YGSelectionModel::getItem (GtkTreeIter *iter)
+{
+ gpointer ptr;
+ gtk_tree_model_get (getModel(), iter, getPtrCol(), &ptr, -1);
+ return (YItem *) ptr;
+}
+
+bool YGSelectionModel::getIter (YItem *item, GtkTreeIter *iter)
+{
+ if (!item)
+ return false;
+ GtkTreePath *path = gtk_tree_path_new();
+ for (; item; item = item->parent()) {
+ int index = GPOINTER_TO_INT (item->data());
+ gtk_tree_path_prepend_index (path, index);
+ }
+
+ bool ret = gtk_tree_model_get_iter (getModel(), iter, path);
+ gtk_tree_path_free (path);
+ return ret;
+}
+
+void YGSelectionModel::implFocusItem (YItem *item)
+{
+ GtkTreeIter iter;
+ if (getIter (item, &iter))
+ setFocusItem (&iter, false);
+}
+
+int YGSelectionModel::getPtrCol()
+{
+ return gtk_tree_model_get_n_columns (getModel()) - 1;
+}
+
+void YGSelectionModel::addRow (GtkTreeIter *iter, YItem *item)
+{
+ struct inner {
+ static void setItemData (GtkTreeModel *model, GtkTreeIter *iter, YItem *item)
+ {
+ int index;
+ GtkTreePath *path = gtk_tree_model_get_path (model, iter);
+
+ int depth = gtk_tree_path_get_depth (path);
+ int *path_int = gtk_tree_path_get_indices (path);
+ g_assert (path_int != NULL);
+ index = path_int [depth-1];
+
+ gtk_tree_path_free (path);
+ g_assert (index != -1);
+ item->setData (GINT_TO_POINTER (index));
+ }
+ };
+
+ bool empty = isEmpty();
+
+ if (isTree) {
+ GtkTreeStore *store = getTreeStore();
+ if (item->parent()) {
+ GtkTreeIter parent;
+ getIter (item->parent(), &parent);
+ gtk_tree_store_append (store, iter, &parent);
+ }
+ else
+ gtk_tree_store_append (store, iter, NULL);
+ gtk_tree_store_set (store, iter, getPtrCol(), item, -1);
+ inner::setItemData (getModel(), iter, item);
+
+ YTreeItem *tree_item = dynamic_cast <YTreeItem *> (item);
+ if (tree_item && tree_item->isOpen())
+ expand (iter);
+ }
+ else {
+ GtkListStore *store = getListStore();
+ gtk_list_store_append (store, iter);
+ gtk_list_store_set (store, iter, getPtrCol(), item, -1);
+ inner::setItemData (getModel(), iter, item);
+ }
+
+ if (item->selected() || empty)
+ setFocusItem (iter, true);
+}
+
+void YGSelectionModel::setCellLabel (GtkTreeIter *iter, int col, const string &label)
+{
+ if (isTree)
+ gtk_tree_store_set (getTreeStore(), iter, col, label.c_str(), -1);
+ else
+ gtk_list_store_set (getListStore(), iter, col, label.c_str(), -1);
+}
+
+void YGSelectionModel::setCellIcon (GtkTreeIter *iter, int col, const string &icon)
+{
+ string path = ywidget->iconFullPath (icon);
+ GdkPixbuf *pixbuf = YGUtils::loadPixbuf (path.c_str());
+ if (isTree)
+ gtk_tree_store_set (getTreeStore(), iter, col, pixbuf, -1);
+ else
+ gtk_list_store_set (getListStore(), iter, col, pixbuf, -1);
+}
+
+void YGSelectionModel::setCellToggle (GtkTreeIter *iter, int col, bool select)
+{
+ if (isTree)
+ gtk_tree_store_set (getTreeStore(), iter, col, select, -1);
+ else
+ gtk_list_store_set (getListStore(), iter, col, select, -1);
+}
+
Added: trunk/gtk/src/YGSelectionModel.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.h?rev=4…
==============================================================================
--- trunk/gtk/src/YGSelectionModel.h (added)
+++ trunk/gtk/src/YGSelectionModel.h Thu Dec 20 21:46:07 2007
@@ -0,0 +1,92 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* Builds a model for the given YItems to be used by YSelectedWidgets. */
+
+#ifndef YGSELECTION_MODEL_H
+#define YGSELECTION_MODEL_H
+
+#include <YItem.h>
+#include <YSelectionWidget.h>
+#include <gtk/gtktreemodel.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtktreestore.h>
+
+struct YGSelectionModel
+{
+ // ordinary model columns
+ enum ColumnIndex {
+ LABEL_COLUMN, ICON_COLUMN
+ };
+
+ YGSelectionModel (YSelectionWidget *ywidget, bool ordinaryModel, bool isTree);
+ virtual ~YGSelectionModel();
+
+ GtkTreeModel *getModel();
+ void createModel (const vector <GType> &types);
+
+ void doAddItem (YItem *item);
+ void doDeleteAllItems();
+
+ virtual YItem *focusItem() = 0;
+ virtual void setFocusItem (GtkTreeIter *iter, bool addingRow) = 0;
+ virtual void unsetFocus() = 0;
+
+ // to be implemented by trees
+ virtual void expand (GtkTreeIter *iter) {}
+
+ YItem *getItem (GtkTreeIter *iter);
+ bool getIter (YItem *item, GtkTreeIter *iter);
+
+ void addRow (GtkTreeIter *iter, YItem *item);
+ void setCellLabel (GtkTreeIter *iter, int col, const string &label);
+ void setCellIcon (GtkTreeIter *iter, int col, const string &icon);
+ void setCellToggle (GtkTreeIter *iter, int col, bool selected);
+
+ int getPtrCol();
+
+protected:
+ void implFocusItem (YItem *item);
+private:
+ GtkTreeModel *m_model;
+ bool isTree;
+ GtkListStore *getListStore();
+ GtkTreeStore *getTreeStore();
+ bool isEmpty();
+ YSelectionWidget *ywidget; // we use it, to get the path for icons
+};
+
+#define YGSELECTION_WIDGET_IMPL_ADD(ParentClass) \
+ virtual void addItem(YItem *item) { \
+ ParentClass::addItem (item); \
+ doAddItem (item); \
+ }
+
+#define YGSELECTION_WIDGET_IMPL_CLEAR(ParentClass) \
+ virtual void deleteAllItems() { \
+ doDeleteAllItems(); \
+ ParentClass::deleteAllItems(); \
+ }
+
+#define YGSELECTION_WIDGET_IMPL_SELECT(ParentClass) \
+ virtual void selectItem (YItem *item, bool select) { \
+ if (select) \
+ implFocusItem (item); \
+ ParentClass::selectItem (item, select); \
+ } \
+ virtual void deselectAllItems() { \
+ unsetFocus(); \
+ ParentClass::deselectAllItems(); \
+ } \
+ virtual YItem *selectedItem() { \
+ return focusItem(); \
+ } \
+
+#define YGSELECTION_WIDGET_IMPL_ALL(ParentClass) \
+ YGSELECTION_WIDGET_IMPL_ADD(ParentClass) \
+ YGSELECTION_WIDGET_IMPL_CLEAR(ParentClass) \
+ YGSELECTION_WIDGET_IMPL_SELECT(ParentClass)
+
+#endif /*YGSELECTION_MODEL_H*/
+
Added: trunk/gtk/src/ygtkcellrenderertextpixbuf.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkcellrenderertextpixb…
==============================================================================
--- trunk/gtk/src/ygtkcellrenderertextpixbuf.c (added)
+++ trunk/gtk/src/ygtkcellrenderertextpixbuf.c Thu Dec 20 21:46:07 2007
@@ -0,0 +1,216 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkCellRendererTextPixbuf widget */
+// check the header file for information about this widget
+
+#include <config.h>
+#include "ygtkcellrenderertextpixbuf.h"
+
+#define PIXBUF_TEXT_SPACING 4
+
+enum {
+ PROP_0,
+ PROP_TEXT,
+ PROP_PIXBUF
+};
+
+G_DEFINE_TYPE (YGtkCellRendererTextPixbuf, ygtk_cell_renderer_text_pixbuf, GTK_TYPE_CELL_RENDERER)
+
+static void ygtk_cell_renderer_text_pixbuf_init (YGtkCellRendererTextPixbuf *tpcell)
+{
+ GtkCellRenderer *cell = GTK_CELL_RENDERER (tpcell);
+ cell->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+ cell->xalign = 0.0;
+ cell->yalign = 0.5;
+ cell->xpad = 0;
+ cell->ypad = 0;
+ tpcell->text = NULL;
+ tpcell->pixbuf = NULL;
+}
+
+static void ygtk_cell_renderer_text_pixbuf_finalize (GObject *object)
+{
+ YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (object);
+ if (tpcell->text) {
+ g_free (tpcell->text);
+ tpcell->text = NULL;
+ }
+ if (tpcell->pixbuf) {
+ g_object_unref (G_OBJECT (tpcell->pixbuf));
+ tpcell->pixbuf = NULL;
+ }
+ G_OBJECT_CLASS (ygtk_cell_renderer_text_pixbuf_parent_class)->finalize (object);
+}
+
+static void ygtk_cell_renderer_text_pixbuf_get_property (GObject *object,
+ guint param_id, GValue *value, GParamSpec *pspec)
+{
+ YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (object);
+ switch (param_id) {
+ case PROP_TEXT:
+ g_value_set_string (value, tpcell->text);
+ break;
+ case PROP_PIXBUF:
+ g_value_set_object (value, G_OBJECT (tpcell->pixbuf));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void ygtk_cell_renderer_text_pixbuf_set_property (GObject *object,
+ guint param_id, const GValue *value, GParamSpec *pspec)
+{
+ YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (object);
+ switch (param_id) {
+ case PROP_TEXT:
+ if (tpcell->text)
+ g_free (tpcell->text);
+ tpcell->text = g_strdup (g_value_get_string (value));
+ break;
+ case PROP_PIXBUF:
+ if (tpcell->pixbuf)
+ g_object_unref (G_OBJECT (tpcell->pixbuf));
+ tpcell->pixbuf = (GdkPixbuf *) g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static PangoLayout *create_layout (YGtkCellRendererTextPixbuf *tpcell, GtkWidget *widget)
+{
+ if (tpcell->text)
+ return gtk_widget_create_pango_layout (widget, tpcell->text);
+ return NULL;
+}
+
+static void ygtk_cell_renderer_text_pixbuf_get_size (GtkCellRenderer *cell,
+ GtkWidget *widget, GdkRectangle *cell_area, gint *xoffset, gint *yoffset,
+ gint *width, gint *height)
+{
+ YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (cell);
+
+ // will be calculated at expose, as both pixbuf and text have their offsets...
+ if (xoffset) *xoffset = 0;
+ if (yoffset) *yoffset = 0;
+ if (!width && !height)
+ return;
+
+ if (tpcell->pixbuf) {
+ *width += gdk_pixbuf_get_width (tpcell->pixbuf);
+ *height = MAX (*height, gdk_pixbuf_get_height (tpcell->pixbuf));
+ }
+ if (tpcell->text) {
+ if (tpcell->pixbuf)
+ *width += PIXBUF_TEXT_SPACING;
+
+ PangoLayout *layout = create_layout (tpcell, widget);
+ int lw, lh;
+ pango_layout_get_pixel_size (layout, &lw, &lh);
+ *width += lw;
+ *height = MAX (*height, lh);
+
+ g_object_unref (G_OBJECT (layout));
+ }
+
+ *width += cell->xpad*2;
+ *height += cell->ypad*2;
+}
+
+static void ygtk_cell_renderer_text_pixbuf_render (GtkCellRenderer *cell,
+ GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area,
+ GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags)
+{
+ YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (cell);
+
+ GtkStateType state;
+ // like GtkCellRendererText...
+ if (!cell->sensitive)
+ state = GTK_STATE_INSENSITIVE;
+ else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED) {
+ gboolean has_focus = GTK_WIDGET_HAS_FOCUS (widget);
+ state = has_focus ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
+ }
+ else if ((flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT &&
+ GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) {
+ state = GTK_STATE_PRELIGHT;
+ }
+ else {
+ if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+ state = GTK_STATE_INSENSITIVE;
+ else
+ state = GTK_STATE_NORMAL;
+ }
+
+ int x = cell_area->x, y = cell_area->y;
+
+ gfloat xalign = cell->xalign, yalign = cell->yalign;
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ xalign = 1.0 - xalign;
+
+ if (tpcell->pixbuf) {
+ int w, h;
+ w = gdk_pixbuf_get_width (tpcell->pixbuf);
+ h = gdk_pixbuf_get_height (tpcell->pixbuf);
+
+ int xoffset, yoffset;
+ xoffset = xalign * (cell_area->width - (w + (2*cell->xpad)));
+ yoffset = yalign * (cell_area->height - (h + (2*cell->ypad)));
+
+ cairo_t *cr = gdk_cairo_create (window);
+ gdk_cairo_set_source_pixbuf (cr, tpcell->pixbuf, x+xoffset, y+yoffset);
+
+ cairo_rectangle (cr, x+xoffset, y+yoffset, w, h);
+ cairo_fill (cr);
+ cairo_destroy (cr);
+
+ x += w + PIXBUF_TEXT_SPACING;
+ }
+
+ if (tpcell->text) {
+ PangoLayout *layout = create_layout (tpcell, widget);
+
+ PangoRectangle rect;
+ pango_layout_get_pixel_extents (layout, NULL, &rect);
+
+ int xoffset, yoffset;
+ xoffset = xalign * (cell_area->width - (rect.width + (2*cell->xpad)));
+ yoffset = yalign * (cell_area->height - (rect.height + (2*cell->ypad)));
+
+ GtkStyle *style = gtk_widget_get_style (widget);
+ gtk_paint_layout (style, window, state, TRUE, expose_area, widget,
+ "cellrenderertext", x+xoffset, y+yoffset, layout);
+
+ g_object_unref (G_OBJECT (layout));
+ }
+}
+
+GtkCellRenderer *ygtk_cell_renderer_text_pixbuf_new (void)
+{
+ return g_object_new (YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF, NULL);
+}
+
+static void ygtk_cell_renderer_text_pixbuf_class_init (YGtkCellRendererTextPixbufClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = ygtk_cell_renderer_text_pixbuf_get_property;
+ object_class->set_property = ygtk_cell_renderer_text_pixbuf_set_property;
+ object_class->finalize = ygtk_cell_renderer_text_pixbuf_finalize;
+
+ GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
+ cell_class->get_size = ygtk_cell_renderer_text_pixbuf_get_size;
+ cell_class->render = ygtk_cell_renderer_text_pixbuf_render;
+
+ g_object_class_install_property (object_class, PROP_TEXT,
+ g_param_spec_string ("text", "Text", "The text", NULL,
+ G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class, PROP_PIXBUF,
+ g_param_spec_object ("pixbuf", "Image", "Side image", GDK_TYPE_PIXBUF,
+ G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
+}
+
Added: trunk/gtk/src/ygtkcellrenderertextpixbuf.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkcellrenderertextpixb…
==============================================================================
--- trunk/gtk/src/ygtkcellrenderertextpixbuf.h (added)
+++ trunk/gtk/src/ygtkcellrenderertextpixbuf.h Thu Dec 20 21:46:07 2007
@@ -0,0 +1,47 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkCellRendererTextPixbuf is a combination of GtkCellRendererText and
+ GtkCellRendererPixbuf. It allows text and icons to be mixed on the same
+ column.
+*/
+
+#ifndef YGTK_CELL_RENDERER_TEXT_PIXBUF_H
+#define YGTK_CELL_RENDERER_TEXT_PIXBUF_H
+
+#include <gtk/gtkcellrenderer.h>
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF (ygtk_cell_renderer_text_pixbuf_get_type ())
+#define YGTK_CELL_RENDERER_TEXT_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF, YGtkCellRendererTextPixbuf))
+#define YGTK_CELL_RENDERER_TEXT_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF, YGtkCellRendererTextPixbufClass))
+#define YGTK_IS_CELL_RENDERER_TEXT_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF))
+#define YGTK_IS_CELL_RENDERER_TEXT_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF))
+#define YGTK_CELL_RENDERER_TEXT_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF, YGtkCellRendererTextPixbufClass))
+
+typedef struct _YGtkCellRendererTextPixbuf
+{
+ GtkCellRenderer parent;
+
+ // private:
+ gchar *text;
+ GdkPixbuf *pixbuf;
+} YGtkCellRendererTextPixbuf;
+
+typedef struct _YGtkCellRendererTextPixbufClass
+{
+ GtkCellRendererClass parent_class;
+} YGtkCellRendererTextPixbufClass;
+
+GtkCellRenderer *ygtk_cell_renderer_text_pixbuf_new (void);
+GType ygtk_cell_renderer_text_pixbuf_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+#endif /*YGTK_CELL_RENDERER_TEXT_PIXBUF_H*/
+
Added: trunk/gtk/src/ygtkscrolledwindow.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkscrolledwindow.c?rev…
==============================================================================
--- trunk/gtk/src/ygtkscrolledwindow.c (added)
+++ trunk/gtk/src/ygtkscrolledwindow.c Thu Dec 20 21:46:07 2007
@@ -0,0 +1,99 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkScrolledWindow widget */
+// check the header file for information about this widget
+
+#include <config.h>
+#include "ygtkscrolledwindow.h"
+#include <gtk/gtk.h>
+
+#define CHILD_SPACING 2
+
+G_DEFINE_TYPE (YGtkScrolledWindow, ygtk_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
+
+static void ygtk_scrolled_window_init (YGtkScrolledWindow *scroll)
+{
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
+}
+
+static void ygtk_scrolled_window_destroy (GtkObject *object)
+{
+ GTK_OBJECT_CLASS (ygtk_scrolled_window_parent_class)->destroy (object);
+ YGtkScrolledWindow *scroll = YGTK_SCROLLED_WINDOW (object);
+ ygtk_scrolled_window_set_corner_widget (scroll, NULL);
+}
+
+static void ygtk_scrolled_window_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GTK_WIDGET_CLASS (ygtk_scrolled_window_parent_class)->size_allocate
+ (widget, allocation);
+ if (!GTK_WIDGET_REALIZED (widget))
+ return;
+
+ YGtkScrolledWindow *scroll = YGTK_SCROLLED_WINDOW (widget);
+ if (scroll->corner_child) {
+ GtkRequisition req;
+ gtk_widget_size_request (scroll->corner_child, &req);
+
+ GtkWidget *vbar;
+ vbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (scroll));
+
+ vbar->allocation.height = MAX (0, widget->allocation.height - req.height - CHILD_SPACING);
+ GtkAllocation alloc = { vbar->allocation.x,
+ vbar->allocation.y + vbar->allocation.height + CHILD_SPACING,
+ vbar->allocation.width,
+ req.height };
+ gtk_widget_size_allocate (scroll->corner_child, &alloc);
+ }
+}
+
+static void ygtk_scrolled_window_forall (GtkContainer *container,
+ gboolean include_internals, GtkCallback callback, gpointer callback_data)
+{
+ GTK_CONTAINER_CLASS (ygtk_scrolled_window_parent_class)->forall (container,
+ include_internals, callback, callback_data);
+ if (include_internals) {
+ YGtkScrolledWindow *scroll = YGTK_SCROLLED_WINDOW (container);
+ if (scroll->corner_child)
+ callback (scroll->corner_child, callback_data);
+ }
+}
+
+void ygtk_scrolled_window_set_corner_widget (YGtkScrolledWindow *scroll, GtkWidget *child)
+{
+ if (scroll->corner_child)
+ gtk_widget_unparent (scroll->corner_child);
+ scroll->corner_child = child;
+ if (child)
+ gtk_widget_set_parent (child, GTK_WIDGET (scroll));
+}
+
+void ygtk_scrolled_window_replace (YGtkScrolledWindow *scroll, GtkWidget *child)
+{
+ GtkWidget *current = gtk_bin_get_child (GTK_BIN (scroll));
+ if (current)
+ gtk_container_remove (GTK_CONTAINER (scroll), current);
+ if (child)
+ gtk_container_add (GTK_CONTAINER (scroll), child);
+}
+
+GtkWidget *ygtk_scrolled_window_new (void)
+{ return g_object_new (YGTK_TYPE_SCROLLED_WINDOW, NULL); }
+
+static void ygtk_scrolled_window_class_init (YGtkScrolledWindowClass *klass)
+{
+ GtkContainerClass *gtkcontainer_class = GTK_CONTAINER_CLASS (klass);
+ gtkcontainer_class->forall = ygtk_scrolled_window_forall;
+
+ GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
+ gtkwidget_class->size_allocate = ygtk_scrolled_window_size_allocate;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_scrolled_window_destroy;
+}
+
Added: trunk/gtk/src/ygtkscrolledwindow.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkscrolledwindow.h?rev…
==============================================================================
--- trunk/gtk/src/ygtkscrolledwindow.h (added)
+++ trunk/gtk/src/ygtkscrolledwindow.h Thu Dec 20 21:46:07 2007
@@ -0,0 +1,51 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkScrolledWindow extends GtkScrolledWindow adding the possibility to add
+ a widget in the corner between the scrollbars, flowing into the vertical
+ scroll bar (which is why the policy should be ALWAYS for the vertical bar).
+*/
+
+#ifndef YGTK_SCROLLED_WINDOW_H
+#define YGTK_SCROLLED_WINDOW_H
+
+#include <gtk/gtkscrolledwindow.h>
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_SCROLLED_WINDOW (ygtk_scrolled_window_get_type ())
+#define YGTK_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindow))
+#define YGTK_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindowClass))
+#define YGTK_IS_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_SCROLLED_WINDOW))
+#define YGTK_IS_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_SCROLLED_WINDOW))
+#define YGTK_SCROLLED_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindowClass))
+
+typedef struct _YGtkScrolledWindow
+{
+ GtkScrolledWindow parent;
+ //members:
+ GtkWidget *corner_child;
+} YGtkScrolledWindow;
+
+typedef struct _YGtkScrolledWindowClass
+{
+ GtkScrolledWindowClass parent_class;
+} YGtkScrolledWindowClass;
+
+GtkWidget* ygtk_scrolled_window_new (void);
+GType ygtk_scrolled_window_get_type (void) G_GNUC_CONST;
+
+// container_add/remove combo
+void ygtk_scrolled_window_replace (YGtkScrolledWindow *scroll, GtkWidget *child);
+
+void ygtk_scrolled_window_set_corner_widget (YGtkScrolledWindow *scroll,
+ GtkWidget *widget);
+
+G_END_DECLS
+#endif /*YGTK_SCROLLED_WINDOW_H*/
+
Added: trunk/gtk/src/ygtktogglebutton.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktogglebutton.c?rev=4…
==============================================================================
--- trunk/gtk/src/ygtktogglebutton.c (added)
+++ trunk/gtk/src/ygtktogglebutton.c Thu Dec 20 21:46:07 2007
@@ -0,0 +1,90 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkToggleButton widget */
+// check the header file for information about this widget
+
+#include <config.h>
+#include "ygtktogglebutton.h"
+#include <gtk/gtk.h>
+
+static guint toggle_changed_signal;
+
+G_DEFINE_TYPE (YGtkToggleButton, ygtk_toggle_button, GTK_TYPE_TOGGLE_BUTTON)
+
+static void ygtk_toggle_button_init (YGtkToggleButton *button)
+{
+}
+
+static void ygtk_toggle_button_destroy (GtkObject *object)
+{
+ GTK_OBJECT_CLASS (ygtk_toggle_button_parent_class)->destroy (object);
+ YGtkToggleButton *button = YGTK_TOGGLE_BUTTON (object);
+ if (button->group && !button->foreign_group) {
+ g_slist_free (button->group);
+ button->group = NULL;
+ }
+}
+
+static void ygtk_toggle_button_toggled (GtkToggleButton *toggle)
+{
+ GSList *group = YGTK_TOGGLE_BUTTON (toggle)->group;
+
+ if (gtk_toggle_button_get_active (toggle)) {
+ // disable any active
+ GSList *i;
+ for (i = group; i; i = i->next) {
+ GtkToggleButton *t = i->data;
+ if (t->active && t != toggle) {
+ gtk_toggle_button_set_active (t, FALSE);
+ break;
+ }
+ }
+
+ if (i) {
+ gint nb = g_slist_index (group, toggle);
+ g_signal_emit (YGTK_TOGGLE_BUTTON (toggle), toggle_changed_signal, 0, nb);
+ }
+ }
+ else {
+ // force it to be enabled, if no other is (other could be enabled; eg. when
+ // this code gets triggered from the previous case).
+ GSList *i;
+ for (i = group; i; i = i->next) {
+ GtkToggleButton *t = i->data;
+ if (t->active && t != toggle)
+ break;
+ }
+ if (!i)
+ gtk_toggle_button_set_active (toggle, TRUE);
+ }
+}
+
+GSList *ygtk_toggle_button_get_group (YGtkToggleButton *button)
+{
+ return button->group;
+}
+
+GtkWidget *ygtk_toggle_button_new (GSList *group)
+{
+ YGtkToggleButton *button = g_object_new (YGTK_TYPE_TOGGLE_BUTTON, NULL);
+ button->group = g_slist_append (group, button);
+ button->foreign_group = group != NULL;
+ return (GtkWidget *) button;
+}
+
+static void ygtk_toggle_button_class_init (YGtkToggleButtonClass *klass)
+{
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_toggle_button_destroy;
+
+ GtkToggleButtonClass *gtktogglebutton_class = GTK_TOGGLE_BUTTON_CLASS (klass);
+ gtktogglebutton_class->toggled = ygtk_toggle_button_toggled;
+
+ toggle_changed_signal = g_signal_new ("toggle-changed",
+ G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (YGtkToggleButtonClass, toggle_changed), NULL, NULL,
+ g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+}
+
Added: trunk/gtk/src/ygtktogglebutton.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktogglebutton.h?rev=4…
==============================================================================
--- trunk/gtk/src/ygtktogglebutton.h (added)
+++ trunk/gtk/src/ygtktogglebutton.h Thu Dec 20 21:46:07 2007
@@ -0,0 +1,49 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkToggleButton extends GtkToggleButton to add groups, just like GtkRadioButtons.
+*/
+
+#ifndef YGTK_TOGGLE_BUTTON_H
+#define YGTK_TOGGLE_BUTTON_H
+
+#include <gtk/gtktogglebutton.h>
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_TOGGLE_BUTTON (ygtk_toggle_button_get_type ())
+#define YGTK_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_TOGGLE_BUTTON, YGtkToggleButton))
+#define YGTK_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_TOGGLE_BUTTON, YGtkToggleButtonClass))
+#define YGTK_IS_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_TOGGLE_BUTTON))
+#define YGTK_IS_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_TOGGLE_BUTTON))
+#define YGTK_TOGGLE_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_TOGGLE_BUTTON, YGtkToggleButtonClass))
+
+typedef struct _YGtkToggleButton
+{
+ GtkToggleButton parent;
+ // members:
+ GSList *group;
+ gboolean foreign_group; // (shouldn't be needed...)
+} YGtkToggleButton;
+
+typedef struct _YGtkToggleButtonClass
+{
+ GtkToggleButtonClass parent_class;
+
+ // signals:
+ void (*toggle_changed) (GtkToggleButton *toggle, gint nb);
+} YGtkToggleButtonClass;
+
+GtkWidget* ygtk_toggle_button_new (GSList *group);
+GType ygtk_toggle_button_get_type (void) G_GNUC_CONST;
+
+GSList *ygtk_toggle_button_get_group (YGtkToggleButton *button);
+
+G_END_DECLS
+#endif /*YGTK_TOGGLE_BUTTON_H*/
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
Author: rpmcruz
Date: Thu Dec 20 21:44:06 2007
New Revision: 43216
URL: http://svn.opensuse.org/viewcvs/yast?rev=43216&view=rev
Log:
Moving unstable-libyui to main.
Modified:
trunk/gtk/src/Makefile.am
trunk/gtk/src/Y2CCGtk.cc
trunk/gtk/src/YGBarGraph.cc
trunk/gtk/src/YGComboBox.cc
trunk/gtk/src/YGDialog.cc
trunk/gtk/src/YGDialog.h
trunk/gtk/src/YGDumbTab.cc
trunk/gtk/src/YGFrame.cc
trunk/gtk/src/YGImage.cc
trunk/gtk/src/YGIntField.cc
trunk/gtk/src/YGLabel.cc
trunk/gtk/src/YGLayout.cc
trunk/gtk/src/YGMenuButton.cc
trunk/gtk/src/YGMultiLineEdit.cc
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/YGProgressBar.cc
trunk/gtk/src/YGPushButton.cc
trunk/gtk/src/YGRadioButton.cc
trunk/gtk/src/YGTable.cc
trunk/gtk/src/YGUI.cc
trunk/gtk/src/YGUI.h
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGUtils.h
trunk/gtk/src/YGWidget.cc
trunk/gtk/src/YGWidget.h
trunk/gtk/src/YGWizard.cc
trunk/gtk/src/ygtkfieldentry.c
trunk/gtk/src/ygtkfieldentry.h
trunk/gtk/src/ygtkfindentry.c
trunk/gtk/src/ygtkimage.c
trunk/gtk/src/ygtkmenubutton.c
trunk/gtk/src/ygtkratiobox.c
trunk/gtk/src/ygtkratiobox.h
trunk/gtk/src/ygtkrichtext.c
trunk/gtk/src/ygtkwizard.c
trunk/gtk/src/ygtkwizard.h
trunk/gtk/src/ygtkzyppwrapper.cc
trunk/gtk/src/ygtkzyppwrapper.h
trunk/gtk/src/yzyppwrapper.cc
trunk/gtk/src/yzyppwrapper.h
Modified: trunk/gtk/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/Makefile.am?rev=43216&r1…
==============================================================================
--- trunk/gtk/src/Makefile.am (original)
+++ trunk/gtk/src/Makefile.am Thu Dec 20 21:44:06 2007
@@ -25,20 +25,19 @@
YGLabel.cc \
YGPushButton.cc \
YGProgressBar.cc \
- YGTextEntry.cc \
+ YGInputField.cc \
YGMultiLineEdit.cc \
YGIntField.cc \
YGRadioButton.cc \
YGImage.cc \
YGFrame.cc \
+ YGSelectionModel.cc \
YGComboBox.cc \
YGTable.cc \
- YGTree.cc \
YGMenuButton.cc \
YGBarGraph.cc \
YGDumbTab.cc \
YGWizard.cc \
- YGTime.cc \
YGPackageSelector.cc \
ygtkratiobox.c \
ygtkbargraph.c \
@@ -49,6 +48,9 @@
ygtkfindentry.c \
ygdkmngloader.c \
ygtkimage.c \
+ ygtkcellrenderertextpixbuf.c \
+ ygtkscrolledwindow.c \
+ ygtktogglebutton.c \
ygtkhtmlwrap.c \
ygtkrichtext.c \
yzyppwrapper.cc \
Modified: trunk/gtk/src/Y2CCGtk.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/Y2CCGtk.cc?rev=43216&r1=…
==============================================================================
--- trunk/gtk/src/Y2CCGtk.cc (original)
+++ trunk/gtk/src/Y2CCGtk.cc Thu Dec 20 21:44:06 2007
@@ -6,16 +6,7 @@
#include <YGUI.h>
#include <YUIComponent.h>
#include <ycp/y2log.h>
-
-#if YAST2_VERSION >= 2015006
-// New UI plugin work
-# include <Y2CCUI.h>
-# define NEW_UI_PLUGIN
-# define Y2CCUI_INIT
-#else
-# define Y2CCUI Y2ComponentCreator
-# define Y2CCUI_INIT Y2ComponentBroker::BUILTIN
-#endif
+#include <Y2CCUI.h>
class YGUIComponent : public YUIComponent
{
@@ -38,7 +29,7 @@
class Y2CCGtk : public Y2CCUI
{
public:
- Y2CCGtk () : Y2CCUI (Y2CCUI_INIT) { };
+ Y2CCGtk() : Y2CCUI() { };
bool isServerCreator () const { return true; };
@@ -46,23 +37,17 @@
{
y2milestone( "Creating %s component", name );
if (!strcmp (name, "gtk") ) {
-#ifdef NEW_UI_PLUGIN
Y2Component* ret = YUIComponent::uiComponent ();
if (!ret || ret->name () != name) {
y2debug ("UI component is %s, creating %s", ret? ret->name().c_str() : "NULL", name);
ret = new YGUIComponent();
}
return ret;
-#else
- return new YGUIComponent();
-#endif
}
- else
- return 0;
+ return 0;
}
};
// Singleton plugin registration instance.
Y2CCGtk g_y2ccgtk;
-
Modified: trunk/gtk/src/YGBarGraph.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGBarGraph.cc?rev=43216&…
==============================================================================
--- trunk/gtk/src/YGBarGraph.cc (original)
+++ trunk/gtk/src/YGBarGraph.cc Thu Dec 20 21:44:06 2007
@@ -13,27 +13,29 @@
class YGBarGraph : public YBarGraph, public YGWidget
{
public:
- YGBarGraph (const YWidgetOpt &opt, YGWidget *parent)
- : YBarGraph (opt)
+ YGBarGraph (YWidget *parent)
+ : YBarGraph (NULL)
, YGWidget (this, parent, true, YGTK_TYPE_BAR_GRAPH, NULL)
- { }
+ {}
// YBarGraph
virtual void doUpdate()
{
ygtk_bar_graph_create_entries (YGTK_BAR_GRAPH (getWidget()), segments());
- for (int i = 0; i < segments(); i++)
+ for (int i = 0; i < segments(); i++) {
+ const YBarGraphSegment &s = segment (i);
ygtk_bar_graph_setup_entry (YGTK_BAR_GRAPH (getWidget()), i,
- label(i).c_str(), value(i));
+ s.label().c_str(), s.value());
+ }
+ // FIXME: new libyui colors segments ... We probably should honor that
}
YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createBarGraph (YWidget *parent, YWidgetOpt &opt)
+YBarGraph *YGOptionalWidgetFactory::createBarGraph (YWidget *parent)
{
- return new YGBarGraph (opt, YGWidget::get (parent));
+ return new YGBarGraph (parent);
}
#include "YPartitionSplitter.h"
@@ -42,50 +44,37 @@
{
public:
YGtkBarGraph *m_barGraph;
- bool m_showDelta;
GtkWidget *m_scale, *m_free_spin, *m_new_spin;
- string m_freeLabel, m_newPartLabel;
- YGPartitionSplitter (const YWidgetOpt &opt, YGWidget *parent,
- int _usedSize, int _totalFreeSize, int _newPartSize,
- int _minNewPartSize, int _minFreeSize,
- const YCPString &usedLabel, const YCPString &freeLabel,
- const YCPString &newPartLabel, const YCPString &freeFieldLabel,
- const YCPString &newPartFieldLabel)
- : YPartitionSplitter (opt, _usedSize, _totalFreeSize, _newPartSize,
- _minNewPartSize, _minFreeSize, usedLabel,
- freeLabel, newPartLabel, freeFieldLabel,
- newPartFieldLabel)
+ YGPartitionSplitter (YWidget *parent, int usedSize, int totalFreeSize, int newPartSize,
+ int minNewPartSize, int minFreeSize, const string &usedLabel, const string &freeLabel,
+ const string &newPartLabel, const string &freeFieldLabel, const string &newPartFieldLabel)
+ : YPartitionSplitter (NULL, usedSize, totalFreeSize, newPartSize, minNewPartSize,
+ minFreeSize, usedLabel, freeLabel, newPartLabel, freeFieldLabel, newPartFieldLabel)
, YGWidget (this, parent, true, GTK_TYPE_VBOX, NULL)
{
/* Bar graph widget */
GtkWidget *graph = ygtk_bar_graph_new();
m_barGraph = YGTK_BAR_GRAPH (graph);
ygtk_bar_graph_create_entries (m_barGraph, 3);
- ygtk_bar_graph_setup_entry (m_barGraph, 0, usedLabel->value_cstr(),
- usedSize());
- m_freeLabel = freeLabel->value();
- m_newPartLabel = newPartLabel->value();
- // the others are setup-ed on SetValue()
+ ygtk_bar_graph_setup_entry (m_barGraph, 0, usedLabel.c_str(), usedSize);
/* Labels over the slider */
GtkWidget *labels_box, *free_label, *new_part_label;
labels_box = gtk_hbox_new (FALSE, 0);
- free_label = gtk_label_new (freeFieldLabel->value_cstr());
- new_part_label = gtk_label_new (newPartFieldLabel->value_cstr());
+ free_label = gtk_label_new (freeFieldLabel.c_str());
+ new_part_label = gtk_label_new (newPartFieldLabel.c_str());
gtk_box_pack_start (GTK_BOX (labels_box), free_label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (labels_box), new_part_label, FALSE, FALSE, 0);
/* Slider and the spinners */
- m_showDelta = opt.countShowDelta.value();
-
GtkWidget *slider_box = gtk_hbox_new (FALSE, 0);
- m_scale = gtk_hscale_new_with_range (minFreeSize(), maxFreeSize(), 1);
+ m_scale = gtk_hscale_new_with_range ((gdouble) minFreeSize, maxFreeSize(), 1);
gtk_scale_set_draw_value (GTK_SCALE (m_scale), FALSE);
m_free_spin = gtk_spin_button_new_with_range
- (minFreeSize(), maxFreeSize(), 1);
+ (minFreeSize, maxFreeSize(), 1);
m_new_spin = gtk_spin_button_new_with_range
- (minNewPartSize(), maxNewPartSize(), 1);
+ (minNewPartSize, maxNewPartSize(), 1);
gtk_box_pack_start (GTK_BOX (slider_box), m_free_spin, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (slider_box), m_scale, TRUE, TRUE, 0);
@@ -103,19 +92,22 @@
gtk_box_pack_start (GTK_BOX (getWidget()), labels_box, FALSE, TRUE, 2);
gtk_box_pack_start (GTK_BOX (getWidget()), slider_box, FALSE, TRUE, 2);
- setValue (newPartSize()); // initialization
+ setValue (newPartSize); // initialization
gtk_widget_show_all (getWidget());
}
// YPartitionSplitter
+ virtual int value()
+ {
+ return gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (m_new_spin));
+ }
+
virtual void setValue (int newValue)
{
IMPL
- YPartitionSplitter::setValue (newValue);
-
- ygtk_bar_graph_setup_entry (m_barGraph, 1, m_freeLabel.c_str(),
- remainingFreeSize());
- ygtk_bar_graph_setup_entry (m_barGraph, 2, m_newPartLabel.c_str(),
+ ygtk_bar_graph_setup_entry (m_barGraph, 1, freeLabel().c_str(),
+ freeSize());
+ ygtk_bar_graph_setup_entry (m_barGraph, 2, newPartLabel().c_str(),
newPartSize());
// block connections
@@ -126,11 +118,9 @@
g_signal_handlers_block_by_func (m_new_spin,
(gpointer) new_spin_changed_cb, this);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_free_spin),
- remainingFreeSize());
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_new_spin),
- newPartSize());
- gtk_range_set_value (GTK_RANGE (m_scale), remainingFreeSize());
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_free_spin), freeSize());
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_new_spin), newPartSize());
+ gtk_range_set_value (GTK_RANGE (m_scale), freeSize());
// unblock connections
g_signal_handlers_unblock_by_func (m_scale,
@@ -146,8 +136,6 @@
IMPL
int newFreeSize = (int) gtk_range_get_value (range);
int newPartSize = pThis->totalFreeSize() - newFreeSize;
- if (pThis->m_showDelta)
- newPartSize += pThis->usedSize();
pThis->setValue (newPartSize);
pThis->emitEvent (YEvent::ValueChanged);
@@ -158,8 +146,6 @@
IMPL
int newFreeSize = gtk_spin_button_get_value_as_int (spin);
int newPartSize = pThis->totalFreeSize() - newFreeSize;
- if (pThis->m_showDelta)
- newPartSize += pThis->usedSize();
pThis->setValue (newPartSize);
pThis->emitEvent (YEvent::ValueChanged);
@@ -168,26 +154,21 @@
static void new_spin_changed_cb (GtkSpinButton *spin, YGPartitionSplitter *pThis)
{
IMPL
- if (pThis->m_showDelta)
- pThis->setValue (pThis->remainingFreeSize() - pThis->totalFreeSize());
- else
- pThis->setValue (gtk_spin_button_get_value_as_int (spin));
+ pThis->setValue (gtk_spin_button_get_value_as_int (spin));
pThis->emitEvent (YEvent::ValueChanged);
}
YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createPartitionSplitter (YWidget *parent, YWidgetOpt &opt,
- int usedSize, int totalFreeSize, int newPartSize,
- int minNewPartSize, int minFreeSize,
- const YCPString &usedLabel,const YCPString &freeLabel,
- const YCPString &newPartLabel,
- const YCPString &freeFieldLabel,
- const YCPString &newPartFieldLabel)
+YPartitionSplitter *YGOptionalWidgetFactory::createPartitionSplitter (YWidget *parent,
+ int usedSize, int totalFreeSize, int newPartSize, int minNewPartSize,
+ int minFreeSize, const string &usedLabel, const string &freeLabel,
+ const string &newPartLabel, const string &freeFieldLabel,
+ const string &newPartFieldLabel)
{
- return new YGPartitionSplitter (opt, YGWidget::get (parent), usedSize,
- totalFreeSize, newPartSize, minNewPartSize, minFreeSize, usedLabel,
- freeLabel, newPartLabel, freeFieldLabel, newPartFieldLabel);
+ return new YGPartitionSplitter (parent, usedSize, totalFreeSize, newPartSize,
+ minNewPartSize, minFreeSize, usedLabel, freeLabel, newPartLabel, freeFieldLabel,
+ newPartFieldLabel);
}
+
Modified: trunk/gtk/src/YGComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=43216&…
==============================================================================
--- trunk/gtk/src/YGComboBox.cc (original)
+++ trunk/gtk/src/YGComboBox.cc Thu Dec 20 21:44:06 2007
@@ -7,43 +7,41 @@
#include <YGUI.h>
#include "YGUtils.h"
#include "YComboBox.h"
+#include "YGSelectionModel.h"
#include "YGWidget.h"
-class YGComboBox : public YComboBox, public YGLabeledWidget
+class YGComboBox : public YComboBox, public YGLabeledWidget, public YGSelectionModel
{
-bool m_showingIcons;
-
public:
- YGComboBox (const YWidgetOpt &opt, YGWidget *parent, YCPString label)
- : YComboBox (opt, label)
+ YGComboBox (YWidget *parent, const string &label, bool editable)
+ : YComboBox (NULL, label, editable)
, YGLabeledWidget (this, parent, label, YD_HORIZ, true,
- opt.isEditable.value() ? GTK_TYPE_COMBO_BOX_ENTRY : GTK_TYPE_COMBO_BOX, NULL)
+ editable ? GTK_TYPE_COMBO_BOX_ENTRY : GTK_TYPE_COMBO_BOX, NULL)
+ , YGSelectionModel (this, true, false)
{
- // pixbufs will be enabled if icons are provided
- m_showingIcons = false;
-
- GtkListStore *store = gtk_list_store_new (2, G_TYPE_STRING, GDK_TYPE_PIXBUF);
- gtk_combo_box_set_model (GTK_COMBO_BOX (getWidget()), GTK_TREE_MODEL (store));
- g_object_unref (store);
-
- if(opt.isEditable.value()) {
- gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (getWidget()), 0);
+ gtk_combo_box_set_model (getComboBox(), getModel());
+ GtkCellRenderer* cell;
+ if (editable) {
+ gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (getWidget()),
+ YGSelectionModel::LABEL_COLUMN);
}
else {
- GtkCellRenderer* cell = gtk_cell_renderer_text_new ();
+ cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (getWidget()), cell, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (getWidget()), cell,
- "text", 0, NULL);
+ "text", YGSelectionModel::LABEL_COLUMN, NULL);
}
+ cell = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (getWidget()), cell, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (getWidget()), cell,
+ "pixbuf", YGSelectionModel::ICON_COLUMN, NULL);
g_signal_connect (G_OBJECT (getWidget()), "changed",
G_CALLBACK (selected_changed_cb), this);
}
- GtkComboBox *getComboBox() const
- {
- return GTK_COMBO_BOX ((const_cast<YGComboBox *>(this)->getWidget()));
- }
+ inline GtkComboBox *getComboBox()
+ { return GTK_COMBO_BOX (getWidget()); }
GtkEntry *getEntry()
{
@@ -61,67 +59,53 @@
return GTK_ENTRY (entry);
}
- virtual void itemAdded (const YCPString &string, int index, bool selected)
+ virtual string text()
{
- GtkListStore *store = GTK_LIST_STORE (gtk_combo_box_get_model (getComboBox()));
- GtkTreeIter iter;
- gtk_list_store_insert (store, &iter, index);
- gtk_list_store_set (store, &iter, 0, string->value_cstr(), -1);
-
- if(hasIcons() && !m_showingIcons) {
- GtkCellRenderer* cell = gtk_cell_renderer_pixbuf_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (getWidget()), cell, FALSE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (getWidget()), cell,
- "pixbuf", 1, NULL);
- m_showingIcons = true;
- }
-
- if (hasIcons() && !itemIcon (index)->value().empty()) {
- std::string path = itemIcon (index)->value();
- if (path[0] != '/')
- path = ICON_DIR + path;
-
- GdkPixbuf *pixbuf;
- GError *error = 0;
- pixbuf = gdk_pixbuf_new_from_file (path.c_str(), &error);
- if (!pixbuf)
- y2warning ("YGComboBox: Could not load icon: %s.\n"
- "Because %s", path.c_str(), error->message);
- gtk_list_store_set (store, &iter, 1, pixbuf, -1);
- }
-
- if (selected || index == 0)
- setCurrentItem (index);
+ return gtk_combo_box_get_active_text (getComboBox());
}
- virtual void setValue (const YCPString &value)
+ virtual void setText (const string &value)
{
IMPL
- gtk_entry_set_text (getEntry(), value->value_cstr());
+ gtk_entry_set_text (getEntry(), value.c_str());
}
- virtual YCPString getValue() const
+ // YGSelectionModel
+ virtual void setFocusItem (GtkTreeIter *iter, bool addingRow)
{
- return YCPString (gtk_combo_box_get_active_text (getComboBox()));
+ // GtkComboBox wants a string on the model, not NULL, when setting it as
+ // the active row. As, we only set that value after addingRow, we need to
+ // initialize it here...
+ if (addingRow)
+ setCellLabel (iter, YGSelectionModel::LABEL_COLUMN, string());
+ gtk_combo_box_set_active_iter (getComboBox(), iter);
}
- virtual int getCurrentItem() const
+ virtual void unsetFocus()
{
- return gtk_combo_box_get_active (getComboBox());
+ gtk_combo_box_set_active (getComboBox(), -1);
}
- virtual void setCurrentItem (int index)
- {
- g_signal_handlers_block_by_func (getWidget(), (gpointer) selected_changed_cb, this);
- gtk_combo_box_set_active (GTK_COMBO_BOX(getWidget()), index);
- g_signal_handlers_unblock_by_func (getWidget(), (gpointer) selected_changed_cb, this);
- }
+ virtual YItem *focusItem()
+ {
+ GtkTreeIter iter;
+ if (gtk_combo_box_get_active_iter (getComboBox(), &iter))
+ return getItem (&iter);
+ return NULL;
+ }
+ // YComboBox
virtual void setInputMaxLength (const YCPInteger &numberOfChars)
{
gtk_entry_set_width_chars (getEntry(), numberOfChars->asInteger()->value());
}
+ virtual void setValidChars (const string &validChars)
+ {
+ YGUtils::setFilter (getEntry(), validChars);
+ YComboBox::setValidChars (validChars);
+ }
+
// Events notifications
static void selected_changed_cb (GtkComboBox *widget, YGComboBox *pThis)
{
@@ -129,29 +113,20 @@
typed some text on a writable ComboBox. text_changed is true for the later and
false for the former. */
bool text_changed = GTK_IS_COMBO_BOX_ENTRY (widget)
- && pThis->getCurrentItem() == -1;
-
- if (text_changed) {
- g_signal_handlers_block_by_func (pThis->getWidget(), (gpointer)
- selected_changed_cb, pThis);
- YGUtils::filterText (GTK_EDITABLE (pThis->getEntry()), 0, -1,
- pThis->getValidChars()->value_cstr());
- g_signal_handlers_unblock_by_func (pThis->getWidget(), (gpointer)
- selected_changed_cb, pThis);
-
+ && pThis->selectedItem() == NULL;
+ if (text_changed)
pThis->emitEvent (YEvent::ValueChanged, true, true);
- }
else
pThis->emitEvent (YEvent::SelectionChanged, true, true);
}
YGWIDGET_IMPL_COMMON
- YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YComboBox)
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YComboBox)
+ YGSELECTION_WIDGET_IMPL_ALL (YComboBox)
};
-YWidget *
-YGUI::createComboBox (YWidget *parent, YWidgetOpt & opt,
- const YCPString & label)
+YComboBox *YGWidgetFactory::createComboBox (YWidget *parent, const string &label, bool editable)
{
- return new YGComboBox (opt, YGWidget::get (parent), label);
+ return new YGComboBox (parent, label, editable);
}
+
Modified: trunk/gtk/src/YGDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=43216&r1…
==============================================================================
--- trunk/gtk/src/YGDialog.cc (original)
+++ trunk/gtk/src/YGDialog.cc Thu Dec 20 21:44:06 2007
@@ -4,14 +4,14 @@
#include <config.h>
#include <ycp/y2log.h>
-#include <YGUI.h>
+#include "YGUI.h"
#include "YGDialog.h"
#include <gdk/gdkkeysyms.h>
#include <math.h> // easter
-/* In the main dialog case (when opt.hasDefaultSize is set), it doesn't
- necessarly have a window of its own. If there is already a main window, it
- should replace its content -- and when closed, the previous dialog restored.
+/* In the main dialog case, it doesn't necessarly have a window of its own. If
+ there is already a main window, it should replace its content -- and when closed,
+ the previous dialog restored.
Therefore, we have a YGDialog (the YDialog implementation), and a YGWindow
that does the windowing work and has a YWidget has its children, which can
@@ -19,248 +19,260 @@
*/
class YGWindow;
-static YGWindow *main_window = NULL;
+static YGWindow *main_window = 0;
-YGWindow::~YGWindow()
+class YGWindow
{
- IMPL
- setChild (NULL);
- gtk_widget_destroy (m_widget);
- g_object_unref (G_OBJECT (m_widget));
-}
+ GtkWidget *m_widget;
+ int m_refcount;
+ // we keep a pointer of the child just for debugging
+ // (ie. dump yast tree)
+ YWidget *m_child;
-void YGWindow::setChild (YWidget *new_child)
-{
- IMPL
- GtkWidget *child = gtk_bin_get_child (GTK_BIN (m_widget));
- if (child)
- gtk_container_remove (GTK_CONTAINER (m_widget), child);
- if (new_child) {
- child = YGWidget::get (new_child)->getLayout();
- gtk_container_add (GTK_CONTAINER (m_widget), child);
- }
- m_child = new_child;
-}
+public:
+ YGWindowCloseFn m_canClose;
+ void *m_canCloseData;
-void YGWindow::ref (YGWindow *window)
-{
- window->m_refcount++;
-}
-void YGWindow::unref (YGWindow *window)
-{
- if (--window->m_refcount == 0) {
- bool is_main_window = (window == main_window);
- delete window;
- if (is_main_window)
- main_window = NULL;
- }
-}
+ YGWindow (bool _main_window)
+ {
+ m_widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ g_object_ref (G_OBJECT (m_widget));
+ gtk_object_sink (GTK_OBJECT (m_widget));
+
+ m_refcount = 0;
+ m_child = NULL;
+ m_canClose = NULL;
+
+ {
+ GtkWindow *parent = NULL;
+ if (main_window)
+ parent = GTK_WINDOW (main_window->getWidget());
+ GtkWindow *window = GTK_WINDOW (m_widget);
+
+ if (parent) {
+ // if there is a parent, this would be a dialog
+ gtk_window_set_title (window, "");
+ gtk_window_set_modal (window, TRUE);
+ gtk_window_set_transient_for (window, parent);
+ gtk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DIALOG);
+ //gtk_window_set_focus_on_map (window, FALSE);
+ }
+ else {
+ gtk_window_set_title (window, "YaST");
+ if (YGUI::ui()->unsetBorder())
+ gtk_window_set_decorated (window, FALSE);
+ }
+
+ if (_main_window) {
+ int w = YGUI::ui()->_getDefaultWidth(),
+ h = YGUI::ui()->_getDefaultHeight();
+ gtk_window_set_default_size (window, w, h);
+ }
+
+ if (YGUI::ui()->setFullscreen())
+ gtk_window_fullscreen (window);
+
+ gtk_window_set_role (window, "yast-gtk");
+ if (!YGUI::ui()->hasWM())
+ g_signal_connect (G_OBJECT (m_widget), "expose-event",
+ G_CALLBACK (draw_border_cb), this);
+ }
-static gboolean draw_border_cb (GtkWidget *widget, GdkEventExpose *event,
- YGWindow *pThis)
-{
- IMPL
- // to avoid background from overlapping, we emit the expose to the containee
- // ourselves
- gtk_container_propagate_expose (GTK_CONTAINER (widget),
- gtk_bin_get_child (GTK_BIN (widget)),
- event);
-
- GtkAllocation *alloc = &widget->allocation;
- gtk_draw_shadow (gtk_widget_get_style (widget), widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
- alloc->x, alloc->y, alloc->width, alloc->height);
- return TRUE;
-}
-
-static gboolean expode_window_timeout_cb (gpointer data)
-{
- GtkWindow *window = YGUI::ui()->currentWindow();
- if (!window)
- return FALSE;
- srand (time (NULL));
- gint x, y;
- gtk_window_get_position (window, &x, &y);
-#if 0
- // OVAL MOVE
- for (int i = 180; i < 360+180; i++) {
- gtk_window_move (window, x+(int)(sin((i*G_PI)/180)*50),
- y+(int)(cos((i*G_PI)/180)*50)+50);
- while (gtk_events_pending())
- gtk_main_iteration();
- usleep (25);
- }
-#else
- // EXPLOSION
- for (int i = 0; i < 40; i++) {
- gtk_window_move (window, x+(int)((((float)(rand())/RAND_MAX)*40)-20),
- y+(int)((((float)(rand())/RAND_MAX)*40)-20));
- while (gtk_events_pending())
- gtk_main_iteration();
- usleep (200);
- }
-#endif
- gtk_window_move (window, x, y);
- return TRUE;
-}
+ if (_main_window)
+ main_window = this;
-gboolean YGWindow::close_window_cb (GtkWidget *widget, GdkEvent *event,
- YGWindow *pThis)
-{
- IMPL
- // never let GTK+ destroy the window! just inform YCP, and let it
- // do its thing.
- pThis->closeWindow();
- return TRUE;
-}
+ g_signal_connect (G_OBJECT (m_widget), "delete-event",
+ G_CALLBACK (close_window_cb), this);
+ g_signal_connect_after (G_OBJECT (m_widget), "key-press-event",
+ G_CALLBACK (key_pressed_cb), this);
+ }
-void YGWindow::closeWindow()
-{
- if (!m_canClose || m_canClose (m_canCloseData))
- YGUI::ui()->sendEvent (new YCancelEvent());
-}
+ ~YGWindow()
+ {
+ IMPL
+ setChild (NULL);
+ gtk_widget_destroy (m_widget);
+ g_object_unref (G_OBJECT (m_widget));
+ }
-static gboolean key_pressed_cb (GtkWidget *widget, GdkEventKey *event,
- YGWindow *pThis)
-{
- IMPL
- // if not main dialog, close it on escape
- if (event->keyval == GDK_Escape &&
- /* not main window */ main_window != pThis)
+ void setChild (YWidget *new_child)
+ {
+ IMPL
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (m_widget));
+ if (child)
+ gtk_container_remove (GTK_CONTAINER (m_widget), child);
+ if (new_child) {
+ child = YGWidget::get (new_child)->getLayout();
+ gtk_container_add (GTK_CONTAINER (m_widget), child);
+ }
+ m_child = new_child;
+ }
+
+ static void ref (YGWindow *window)
{
- pThis->closeWindow();
- return TRUE;
-
+ window->m_refcount++;
}
- if (event->state & GDK_SHIFT_MASK) {
- switch (event->keyval) {
- case GDK_F8:
- YGUI::ui()->askSaveLogs();
- return TRUE;
- default:
- break;
+ static void unref (YGWindow *window)
+ {
+ if (--window->m_refcount == 0) {
+ bool is_main_window = (window == main_window);
+ delete window;
+ if (is_main_window)
+ main_window = NULL;
}
}
- if ((event->state & GDK_CONTROL_MASK) && (event->state & GDK_SHIFT_MASK)
- && (event->state & GDK_MOD1_MASK)) {
- y2milestone ("Caught YaST2 magic key combination");
- switch (event->keyval) {
- case GDK_S:
- YGUI::ui()->makeScreenShot("");
- return TRUE;
- case GDK_M:
- YGUI::ui()->toggleRecordMacro();
- return TRUE;
- case GDK_P:
- YGUI::ui()->askPlayMacro();
- return TRUE;
- case GDK_D:
- YGUI::ui()->sendEvent (new YDebugEvent());
- return TRUE;
- case GDK_X:
- y2milestone ("Starting xterm");
- system ("/usr/bin/xterm &");
- return TRUE;
- case GDK_T:
- dumpYastTree (pThis->getChild());
- return TRUE;
- case GDK_H:
- dumpYastHtml (pThis->getChild());
- return TRUE;
- case GDK_E: // easter egg
- static guint explode_timeout = 0;
- if (explode_timeout == 0)
- explode_timeout = g_timeout_add (10000,
- expode_window_timeout_cb, NULL);
- else {
- g_source_remove (explode_timeout);
- explode_timeout = 0;
- }
- return TRUE;
- default:
- break;
- }
- }
- return FALSE;
-}
-YGWindow::YGWindow (bool main_window)
-{
- m_widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_object_ref (G_OBJECT (m_widget));
- gtk_object_sink (GTK_OBJECT (m_widget));
-
- m_refcount = 0;
- if (main_window)
- ::main_window = this;
- m_child = NULL;
- m_canClose = NULL;
-
- {
- GtkWindow *parent = YGUI::ui()->currentWindow();
- GtkWindow *window = GTK_WINDOW (m_widget);
-
- if (parent) {
- // if there is a parent, this would be a dialog
- gtk_window_set_title (window, "");
- gtk_window_set_modal (window, TRUE);
- gtk_window_set_transient_for (window, parent);
- gtk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DIALOG);
- //gtk_window_set_focus_on_map (window, FALSE);
- }
- else {
- gtk_window_set_title (window, "YaST");
- if (YGUI::ui()->unsetBorder())
- gtk_window_set_decorated (window, FALSE);
- }
-
- if (main_window) {
- int w = YGUI::ui()->getDefaultSize (YD_HORIZ),
- h = YGUI::ui()->getDefaultSize (YD_VERT);
- gtk_window_set_default_size (window, w, h);
- }
-
- gtk_window_set_role (window, "yast-gtk");
- if (!YGUI::ui()->hasWM())
- g_signal_connect (G_OBJECT (m_widget), "expose-event",
- G_CALLBACK (draw_border_cb), this);
- }
+ // Y(G)Widget-like methods
+ GtkWidget *getWidget() { return m_widget; }
+ YWidget *getChild() { return m_child; }
- g_signal_connect (G_OBJECT (m_widget), "delete-event",
- G_CALLBACK (close_window_cb), this);
- g_signal_connect_after (G_OBJECT (m_widget), "key-press-event",
- G_CALLBACK (key_pressed_cb), this);
-}
+private:
+ void close()
+ {
+ if (!m_canClose || m_canClose (m_canCloseData))
+ YGUI::ui()->sendEvent (new YCancelEvent());
+ }
-void YGWindow::setCloseCallback (YGWindowCloseFn canClose, void *canCloseData)
-{
- m_canClose = canClose;
- m_canCloseData = canCloseData;
-}
+ static gboolean close_window_cb (GtkWidget *widget, GdkEvent *event,
+ YGWindow *pThis)
+ {
+ IMPL
+ // never let GTK+ destroy the window! just inform YCP, and let it
+ // do its thing.
+ pThis->close();
+ return TRUE;
+ }
-void YGWindow::unsetCloseCallback()
-{
- m_canClose = NULL;
-}
+ static gboolean key_pressed_cb (GtkWidget *widget, GdkEventKey *event,
+ YGWindow *pThis)
+ {
+ IMPL
+ // if not main dialog, close it on escape
+ if (event->keyval == GDK_Escape &&
+ /* not main window */ main_window != pThis)
+ {
+ pThis->close();
+ return TRUE;
+
+ }
+
+ if (event->state & GDK_SHIFT_MASK) {
+ switch (event->keyval) {
+ case GDK_F8:
+ YGUI::ui()->askSaveLogs();
+ return TRUE;
+ default:
+ break;
+ }
+ }
+ if ((event->state & GDK_CONTROL_MASK) && (event->state & GDK_SHIFT_MASK)
+ && (event->state & GDK_MOD1_MASK)) {
+ y2milestone ("Caught YaST2 magic key combination");
+ switch (event->keyval) {
+ case GDK_S:
+ YGUI::ui()->makeScreenShot("");
+ return TRUE;
+ case GDK_M:
+ YGUI::ui()->toggleRecordMacro();
+ return TRUE;
+ case GDK_P:
+ YGUI::ui()->askPlayMacro();
+ return TRUE;
+ case GDK_D:
+ YGUI::ui()->sendEvent (new YDebugEvent());
+ return TRUE;
+ case GDK_X:
+ y2milestone ("Starting xterm");
+ system ("/usr/bin/xterm &");
+ return TRUE;
+ case GDK_T:
+ dumpYastTree (pThis->getChild());
+ return TRUE;
+ case GDK_H:
+ dumpYastHtml (pThis->getChild());
+ return TRUE;
+ case GDK_E: // easter egg
+ static guint explode_timeout = 0;
+ if (explode_timeout == 0)
+ explode_timeout = g_timeout_add (10000,
+ expode_window_timeout_cb, pThis);
+ else {
+ g_source_remove (explode_timeout);
+ explode_timeout = 0;
+ }
+ return TRUE;
+ default:
+ break;
+ }
+ }
+ return FALSE;
+ }
+
+ static gboolean draw_border_cb (GtkWidget *widget, GdkEventExpose *event,
+ YGWindow *pThis)
+ {
+ IMPL
+ // to avoid background from overlapping, we emit the expose to the containee
+ // ourselves
+ gtk_container_propagate_expose (GTK_CONTAINER (widget),
+ gtk_bin_get_child (GTK_BIN (widget)),
+ event);
+
+ GtkAllocation *alloc = &widget->allocation;
+ gtk_draw_shadow (gtk_widget_get_style (widget), widget->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
+ alloc->x, alloc->y, alloc->width, alloc->height);
+ return TRUE;
+ }
+
+ static gboolean expode_window_timeout_cb (gpointer data)
+ {
+ YGWindow *pThis = (YGWindow *) data;
+ GtkWindow *window = GTK_WINDOW (pThis->m_widget);
+ srand (time (NULL));
+ gint x, y;
+ gtk_window_get_position (window, &x, &y);
+ #if 0
+ // OVAL MOVE
+ for (int i = 180; i < 360+180; i++) {
+ gtk_window_move (window, x+(int)(sin((i*G_PI)/180)*50),
+ y+(int)(cos((i*G_PI)/180)*50)+50);
+ while (gtk_events_pending())
+ gtk_main_iteration();
+ usleep (25);
+ }
+ #else
+ // EXPLOSION
+ for (int i = 0; i < 40; i++) {
+ gtk_window_move (window, x+(int)((((float)(rand())/RAND_MAX)*40)-20),
+ y+(int)((((float)(rand())/RAND_MAX)*40)-20));
+ while (gtk_events_pending())
+ gtk_main_iteration();
+ usleep (200);
+ }
+ #endif
+ gtk_window_move (window, x, y);
+ return TRUE;
+ }
+};
-YGDialog::YGDialog (YWidgetOpt &opt)
- : YDialog (opt),
- YGWidget (this, NULL, FALSE, GTK_TYPE_HBOX, NULL)
+YGDialog::YGDialog (YDialogType dialogType, YDialogColorMode colorMode)
+ : YDialog (dialogType, colorMode),
+ YGWidget (this, NULL, FALSE, GTK_TYPE_HBOX, NULL)
{
setBorder (0);
- m_padding = 0;
m_containee = gtk_event_box_new();
- if (hasDefaultSize() && main_window)
+ if (dialogType == YMainDialog && main_window)
m_window = main_window;
else
- m_window = new YGWindow (hasDefaultSize());
+ m_window = new YGWindow (dialogType == YMainDialog);
YGWindow::ref (m_window);
- if (hasWarnColor() || hasInfoColor()) {
+ if (colorMode != YDialogNormalColor) {
// emulate a warning / info dialog
GtkWidget *icon = gtk_image_new_from_stock
- (hasWarnColor() ? GTK_STOCK_DIALOG_WARNING : GTK_STOCK_DIALOG_INFO,
+ (colorMode == YDialogWarnColor ? GTK_STOCK_DIALOG_WARNING : GTK_STOCK_DIALOG_INFO,
GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0);
gtk_misc_set_padding (GTK_MISC (icon), 0, 12);
@@ -270,7 +282,6 @@
GtkRequisition req;
gtk_widget_size_request (icon, &req);
- m_padding = req.width + 24;
}
else
gtk_box_pack_start (GTK_BOX (getWidget()), m_containee, TRUE, TRUE, 0);
@@ -303,31 +314,22 @@
gtk_widget_hide (m_window->getWidget());
}
-YDialog *
-YGUI::createDialog (YWidgetOpt &opt)
-{
- IMPL
- return new YGDialog (opt);
-}
-
static list <YGDialog *> dialogs_stack;
-void
-YGUI::showDialog (YDialog *_dialog)
+void YGUI::showDialog (YDialog *_dialog)
{
IMPL
YGDialog *dialog = static_cast <YGDialog *> (_dialog);
- if (dialog->hasDefaultSize())
+ if (dialog->dialogType() == YMainDialog)
dialogs_stack.push_back (dialog);
dialog->showWindow();
}
-void
-YGUI::closeDialog (YDialog *_dialog)
+void YGUI::closeDialog (YDialog *_dialog)
{
IMPL
YGDialog *dialog = static_cast <YGDialog *> (_dialog);
- if (dialog->hasDefaultSize()) {
+ if (dialog->dialogType() == YMainDialog) {
dialogs_stack.pop_back();
if (!dialogs_stack.empty()) {
YGDialog *old_dialog = dialogs_stack.back();
@@ -340,24 +342,36 @@
dialog->hideWindow();
}
-GtkWindow *
-YGUI::currentWindow()
+YGDialog *YGDialog::currentDialog()
{
- YDialog *ydialog = YGUI::ui()->currentDialog();
+ YDialog *ydialog = YDialog::currentDialog (false);
if (ydialog)
- return static_cast<YGDialog *>(ydialog)->getWindow();
- else
- return NULL;
+ return static_cast <YGDialog *> (ydialog);
+ return NULL;
}
-YGDialog *
-YGUI::currentYGDialog()
+GtkWindow *YGDialog::currentWindow()
{
- YDialog *ydialog = YGUI::ui()->currentDialog();
+ YGDialog *ydialog = YGDialog::currentDialog();
if (ydialog)
- return static_cast<YGDialog *>(ydialog);
- else
- return NULL;
+ return GTK_WINDOW (ydialog->m_window->getWidget());
+ return NULL;
+}
+
+void YGDialog::setCloseCallback (YGWindowCloseFn canClose, void *canCloseData)
+{
+ m_window->m_canClose = canClose;
+ m_window->m_canCloseData = canCloseData;
+}
+
+void YGDialog::unsetCloseCallback()
+{
+ m_window->m_canClose = NULL;
+}
+
+void YGDialog::normalCursor()
+{
+ gdk_window_set_cursor (m_window->getWidget()->window, NULL);
}
void YGDialog::busyCursor()
@@ -372,8 +386,9 @@
gdk_window_set_cursor (m_window->getWidget()->window, cursor);
}
-void YGDialog::normalCursor()
+YDialog *YGWidgetFactory::createDialog (YDialogType dialogType, YDialogColorMode colorMode)
{
- gdk_window_set_cursor (m_window->getWidget()->window, NULL);
+ IMPL
+ return new YGDialog (dialogType, colorMode);
}
Modified: trunk/gtk/src/YGDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.h?rev=43216&r1=…
==============================================================================
--- trunk/gtk/src/YGDialog.h (original)
+++ trunk/gtk/src/YGDialog.h Thu Dec 20 21:44:06 2007
@@ -4,64 +4,31 @@
#include "YGWidget.h"
#include "YDialog.h"
+class YGWindow;
typedef bool (*YGWindowCloseFn) (void *closure);
-class YGWindow
-{
- GtkWidget *m_widget;
- int m_refcount;
- // we keep a pointer of the child just for debugging
- // (ie. dump yast tree)
- YWidget *m_child;
- YGWindowCloseFn m_canClose;
- void *m_canCloseData;
-
-private:
- static gboolean close_window_cb (GtkWidget *widget, GdkEvent *event,
- YGWindow *pThis);
-public:
- YGWindow (bool main_window);
- ~YGWindow();
- void setChild (YWidget *new_child);
- static void ref (YGWindow *window);
- static void unref (YGWindow *window);
-
- void normalCursor();
- void busyCursor();
-
- void setCloseCallback (YGWindowCloseFn canClose, void *canCloseData);
- void unsetCloseCallback();
- void closeWindow();
-
- // Y(G)Widget-like methods
- GtkWidget *getWidget() { return m_widget; }
- YWidget *getChild() { return m_child; }
-};
-
class YGDialog : public YDialog, public YGWidget
{
- int m_padding;
GtkWidget *m_containee;
-
YGWindow *m_window;
public:
- YGDialog (YWidgetOpt &opt);
+ YGDialog (YDialogType dialogType, YDialogColorMode colorMode);
virtual ~YGDialog();
void showWindow();
void hideWindow();
- GtkWindow *getWindow() { return GTK_WINDOW (m_window->getWidget()); }
- void setCloseCallback (YGWindowCloseFn closeCallback, void *closeData)
- { m_window->setCloseCallback (closeCallback, closeData); }
- void unsetCloseCallback()
- { m_window->unsetCloseCallback(); }
+ void setCloseCallback (YGWindowCloseFn closeCallback, void *closeData);
+ void unsetCloseCallback();
void normalCursor();
void busyCursor();
- YGWIDGET_IMPL_COMMON
+ // convenience function to be used rather than currentDialog()
+ static YGDialog *currentDialog();
+ static GtkWindow *currentWindow();
+ YGWIDGET_IMPL_COMMON
YGWIDGET_IMPL_CHILD_ADDED (m_containee)
YGWIDGET_IMPL_CHILD_REMOVED (m_containee)
};
Modified: trunk/gtk/src/YGDumbTab.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDumbTab.cc?rev=43216&r…
==============================================================================
--- trunk/gtk/src/YGDumbTab.cc (original)
+++ trunk/gtk/src/YGDumbTab.cc Thu Dec 20 21:44:06 2007
@@ -15,18 +15,16 @@
{
GtkWidget *m_containee;
GtkWidget *m_last_tab;
- vector <GtkWidget *> m_tab_widgets;
public:
- YGDumbTab (const YWidgetOpt &opt, YGWidget *parent)
- : YDumbTab (opt),
+ YGDumbTab (YWidget *parent)
+ : YDumbTab (NULL),
YGWidget (this, parent, true, GTK_TYPE_NOTEBOOK, NULL)
{
IMPL
m_containee = gtk_event_box_new();
gtk_widget_show (m_containee);
- g_object_ref (G_OBJECT (m_containee));
- gtk_object_sink (GTK_OBJECT (m_containee));
+ g_object_ref_sink (G_OBJECT (m_containee));
m_last_tab = 0;
// GTK+ keeps the notebook size set to the biggset page. We can't
@@ -34,8 +32,8 @@
// reduce its size.
ygtk_adj_size_set_only_expand (YGTK_ADJ_SIZE (m_adj_size), TRUE);
- g_signal_connect (G_OBJECT (getWidget()), "switch-page",
- G_CALLBACK (changed_tab_cb), this);
+ g_signal_connect_after (G_OBJECT (getWidget()), "switch-page",
+ G_CALLBACK (changed_tab_cb), this);
}
~YGDumbTab()
@@ -45,64 +43,102 @@
g_object_unref (G_OBJECT (m_containee));
}
- virtual void addTab (const YCPString &label_text)
+ virtual void addItem (YItem *item)
{
- IMPL
- // the tab label
- string str = YGUtils::mapKBAccel (label_text->value_cstr());
- GtkWidget *label = gtk_label_new (str.c_str());
+ GtkWidget *tab_label, *image = 0, *label;
+
+ string str = YGUtils::mapKBAccel (item->label());
+ label = gtk_label_new_with_mnemonic (str.c_str());
gtk_widget_show (label);
+ if (item->hasIconName()) {
+ string path = iconFullPath (item->iconName());
+ GdkPixbuf *pixbuf = YGUtils::loadPixbuf (path);
+ if (pixbuf)
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ }
+
+ if (image) {
+ tab_label = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (tab_label), image, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (tab_label), label, TRUE, TRUE, 0);
+ }
+ else
+ tab_label = label;
+ gtk_widget_show_all (tab_label);
+
GtkNotebook *notebook = GTK_NOTEBOOK (getWidget());
g_signal_handlers_block_by_func (notebook, (gpointer) changed_tab_cb, this);
- GtkWidget *empty = gtk_event_box_new();
- gtk_widget_show (empty);
+ GtkWidget *page = gtk_event_box_new();
+ gtk_widget_show (page);
+ item->setData ((void *) page);
+ g_object_set_data (G_OBJECT (page), "yitem", item);
- gtk_notebook_append_page (notebook, empty, label);
- m_tab_widgets.push_back (empty);
+ gtk_notebook_append_page (notebook, page, tab_label);
- if (!m_last_tab)
- change_tab (0);
+ if (!m_last_tab) /*first tab*/
+ syncTabPage();
g_signal_handlers_unblock_by_func (notebook, (gpointer) changed_tab_cb, this);
}
+ virtual void deleteAllItems()
+ {
+ GList *children = gtk_container_get_children (GTK_CONTAINER (getWidget()));
+ for (GList *i = children; i; i = i->next)
+ gtk_container_remove (GTK_CONTAINER (getWidget()), (GtkWidget *) i->data);
+ g_list_free (children);
+ }
+
// to re-use the same widget in all tabs (m_fixed), we will remove and
// add to the tabs' child as tabs are changed
- void change_tab (int tab_nb)
+ void syncTabPage()
{
if (m_last_tab)
gtk_container_remove (GTK_CONTAINER (m_last_tab), m_containee);
- GtkWidget *tab = m_tab_widgets [tab_nb];
+ GtkNotebook *notebook = GTK_NOTEBOOK (getWidget());
+ int nb = gtk_notebook_get_current_page (notebook);
+ GtkWidget *tab = gtk_notebook_get_nth_page (notebook, nb);
+
gtk_container_add (GTK_CONTAINER (tab), m_containee);
m_last_tab = tab;
}
- virtual int getSelectedTabIndex()
+ virtual YItem *selectedItem()
{
IMPL
- return gtk_notebook_get_current_page (GTK_NOTEBOOK (getWidget()));
+ GtkNotebook *notebook = GTK_NOTEBOOK (getWidget());
+ int nb = gtk_notebook_get_current_page (notebook);
+ GtkWidget *child = gtk_notebook_get_nth_page (notebook, nb);
+ return (YItem *) g_object_get_data (G_OBJECT (child), "yitem");
}
- virtual void setSelectedTab (int index)
+ virtual void selectItem (YItem *item, bool selected)
{
IMPL
- change_tab (index);
-
- g_signal_handlers_block_by_func (getWidget(), (gpointer) changed_tab_cb, this);
- gtk_notebook_set_current_page (GTK_NOTEBOOK (getWidget()), index);
- g_signal_handlers_unblock_by_func (getWidget(), (gpointer) changed_tab_cb, this);
+ if (selected) {
+ GtkWidget *child = (GtkWidget *) item->data();
+ int page = gtk_notebook_page_num (GTK_NOTEBOOK (getWidget()), child);
+
+ g_signal_handlers_block_by_func (getWidget(),
+ (gpointer) changed_tab_cb, this);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (getWidget()), page);
+ g_signal_handlers_unblock_by_func (getWidget(),
+ (gpointer) changed_tab_cb, this);
+ syncTabPage();
+ }
}
static void changed_tab_cb (GtkNotebook *notebook, GtkNotebookPage *page,
gint tab_nb, YGDumbTab *pThis)
{
- YCPValue id = pThis->_tabs[tab_nb].id();
- YGUI::ui()->sendEvent (new YMenuEvent (id));
+ GtkWidget *child = gtk_notebook_get_nth_page (notebook, tab_nb);
+ YItem *item = (YItem *) g_object_get_data (G_OBJECT (child), "yitem");
- pThis->change_tab (tab_nb);
+ YGUI::ui()->sendEvent (new YMenuEvent (item));
+ pThis->syncTabPage();
}
YGWIDGET_IMPL_COMMON
@@ -110,9 +146,9 @@
YGWIDGET_IMPL_CHILD_REMOVED (m_containee)
};
-YWidget *
-YGUI::createDumbTab (YWidget *parent, YWidgetOpt &opt)
+YDumbTab *YGOptionalWidgetFactory::createDumbTab (YWidget *parent)
{
IMPL
- return new YGDumbTab (opt, YGWidget::get (parent));
+ return new YGDumbTab (parent);
}
+
Modified: trunk/gtk/src/YGFrame.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGFrame.cc?rev=43216&r1=…
==============================================================================
--- trunk/gtk/src/YGFrame.cc (original)
+++ trunk/gtk/src/YGFrame.cc Thu Dec 20 21:44:06 2007
@@ -18,8 +18,8 @@
GtkWidget *m_containee;
public:
- YGBaseFrame (YWidget *y_widget, YGWidget *parent)
- : YGWidget (y_widget, parent, true, GTK_TYPE_FRAME,
+ YGBaseFrame (YWidget *ywidget, YWidget *parent)
+ : YGWidget (ywidget, parent, true, GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_NONE, NULL)
{
IMPL
@@ -36,8 +36,8 @@
class YGFrame : public YFrame, public YGBaseFrame
{
public:
- YGFrame (const YWidgetOpt &opt, YGWidget *parent, const YCPString &label)
- : YFrame (opt, label),
+ YGFrame (YWidget *parent, const string &label)
+ : YFrame (NULL, label),
YGBaseFrame (this, parent)
{
GtkWidget *label_widget = gtk_label_new ("");
@@ -51,18 +51,16 @@
virtual ~YGFrame() {}
// YFrame
- virtual void setLabel (const YCPString &_str)
+ virtual void setLabel (const string &_str)
{
IMPL
- /* Get rid of mnemonics; make no sense here. */
- const char *_cstr = _str->value_cstr();
- size_t _clen = strlen (_cstr);
-
+ /* Get rid of mnemonics; makes no sense here. */
+ size_t length = _str.length();
string str;
- str.reserve (_clen);
- for (size_t i = 0; i < _clen; i++)
- if (_cstr[i] != '&')
- str += _cstr[i];
+ str.reserve (length);
+ for (size_t i = 0; i < length; i++)
+ if (_str[i] != '&')
+ str += _str[i];
GtkWidget *label = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
gtk_label_set_text (GTK_LABEL (label), str.c_str());
@@ -75,23 +73,20 @@
YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
};
-YContainerWidget *
-YGUI::createFrame (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label)
+
+YFrame *YGWidgetFactory::createFrame (YWidget *parent, const string &label)
{
IMPL
- return new YGFrame (opt, YGWidget::get (parent), label);
+ return new YGFrame (parent, label);
}
-#if YAST2_YGUI_CHECKBOX_FRAME
#include "YCheckBoxFrame.h"
class YGCheckBoxFrame : public YCheckBoxFrame, public YGBaseFrame
{
public:
- YGCheckBoxFrame (const YWidgetOpt &opt, YGWidget *parent,
- const YCPString &label, bool checked)
- : YCheckBoxFrame (opt, label),
+ YGCheckBoxFrame (YWidget *parent, const string &label, bool checked)
+ : YCheckBoxFrame (NULL, label, checked),
YGBaseFrame (this, parent)
{
IMPL
@@ -109,40 +104,38 @@
virtual ~YGCheckBoxFrame() {}
// YCheckBoxFrame
- virtual void setLabel (const YCPString &_str)
+ virtual void setLabel (const string &_str)
{
GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
GtkLabel *label = GTK_LABEL (GTK_BIN (button)->child);
- string str (YGUtils::mapKBAccel (_str->value_cstr()));
+ string str (YGUtils::mapKBAccel (_str));
gtk_label_set_text_with_mnemonic (label, str.c_str());
YCheckBoxFrame::setLabel (_str);
}
- bool getValue()
+ bool value()
{
GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
}
- void setValue (bool newValue)
+ void setValue (bool value)
{
GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), newValue);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), value);
}
virtual void setEnabling (bool enabled)
{
GtkWidget *frame = getWidget();
- if (enabled)
- {
+ if (enabled) {
gtk_widget_set_sensitive (frame, TRUE);
- handleChildrenEnablement (getValue());
+ handleChildrenEnablement (value());
}
- else
- {
- setChildrenEnabling( false );
+ else {
gtk_widget_set_sensitive (frame, FALSE);
+ YWidget::setChildrenEnabled (false);
}
}
@@ -153,19 +146,15 @@
static void toggled_cb (GtkWidget *widget, YGCheckBoxFrame *pThis)
{
pThis->setEnabling (true);
- if (pThis->getNotify())
+ if (pThis->notify())
YGUI::ui()->sendEvent (new YWidgetEvent (pThis, YEvent::ValueChanged));
}
};
-YContainerWidget *
-YGUI::createCheckBoxFrame (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, bool checked)
+YCheckBoxFrame *YGWidgetFactory::createCheckBoxFrame (YWidget *parent, const string &label,
+ bool checked)
{
IMPL
- return new YGCheckBoxFrame (opt, YGWidget::get (parent), label, checked);
+ return new YGCheckBoxFrame (parent, label, checked);
}
-#else
-# warning "Not compiling CheckBoxFrame..."
-#endif /*YAST2_YGUI_CHECKBOX_FRAME*/
Modified: trunk/gtk/src/YGImage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGImage.cc?rev=43216&r1=…
==============================================================================
--- trunk/gtk/src/YGImage.cc (original)
+++ trunk/gtk/src/YGImage.cc Thu Dec 20 21:44:06 2007
@@ -12,67 +12,28 @@
class YGImage : public YImage, public YGWidget
{
- void setProps (const YWidgetOpt &opt, const YCPString &alt_text)
- {
- bool scale = opt.scaleToFit.value(), tile = opt.tiled.value();
- YGtkImageAlign align = CENTER_IMAGE_ALIGN;
- if (tile)
- align = TILE_IMAGE_ALIGN;
- if (scale)
- align = SCALE_IMAGE_ALIGN;
- if (scale && tile)
- y2warning ("YImage can't be scaled and tiled at the same time");
- ygtk_image_set_props (YGTK_IMAGE (getWidget()), align, alt_text->value_cstr());
-
- bool zeroWidth = opt.zeroWidth.value(), zeroHeight = opt.zeroHeight.value();
- if (zeroWidth || scale || tile)
- setStretchable (YD_HORIZ, true);
- if (zeroHeight || scale || tile)
- setStretchable (YD_VERT, true);
- gtk_widget_set_size_request (getWidget(), zeroWidth ? 1 : -1, zeroHeight ? 1 : -1);
- }
-
public:
- YGImage (const YWidgetOpt &opt, YGWidget *parent,
- const YCPString &filename_str, const YCPString &text)
- : YImage (opt),
+ YGImage (YWidget *parent, const string &filename, bool animated)
+ : YImage (NULL, filename, animated),
YGWidget (this, parent, true, YGTK_TYPE_IMAGE, NULL)
{
IMPL
- setProps (opt, text);
- const char *filename = filename_str->value_cstr();
- bool animated = opt.animated.value();
- ygtk_image_set_from_file (YGTK_IMAGE (getWidget()), filename, animated);
+ ygtk_image_set_from_file (YGTK_IMAGE (getWidget()), filename.c_str(), animated);
}
- YGImage (const YWidgetOpt &opt, YGWidget *parent,
- const YCPByteblock &byteblock, const YCPString &text)
- : YImage (opt),
- YGWidget (this, parent, true, YGTK_TYPE_IMAGE, NULL)
+ virtual void setAutoScale (bool scale)
{
- IMPL
- setProps (opt, text);
- const guint8 *data = byteblock->value();
- long data_size = byteblock->size();
- bool animated = opt.animated.value();
- ygtk_image_set_from_data (YGTK_IMAGE (getWidget()), data, data_size, animated);
+ YGtkImageAlign align = CENTER_IMAGE_ALIGN;
+ if (scale)
+ align = SCALE_IMAGE_ALIGN;
+ ygtk_image_set_props (YGTK_IMAGE (getWidget()), align, NULL);
}
YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createImage (YWidget *parent, YWidgetOpt &opt,
- YCPByteblock image_data, YCPString default_text)
+YImage *YGWidgetFactory::createImage (YWidget *parent, const string &filename, bool animated)
{
- IMPL
- return new YGImage (opt, YGWidget::get (parent), image_data, default_text);
+ return new YGImage (parent, filename, animated);
}
-YWidget *
-YGUI::createImage (YWidget *parent, YWidgetOpt &opt,
- YCPString file_name, YCPString default_text)
-{
- IMPL
- return new YGImage (opt, YGWidget::get (parent), file_name, default_text);
-}
Modified: trunk/gtk/src/YGIntField.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGIntField.cc?rev=43216&…
==============================================================================
--- trunk/gtk/src/YGIntField.cc (original)
+++ trunk/gtk/src/YGIntField.cc Thu Dec 20 21:44:06 2007
@@ -4,7 +4,7 @@
#include <config.h>
#include <ycp/y2log.h>
-#include <YGUI.h>
+#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
@@ -12,14 +12,13 @@
class YGSpinBox : public YGLabeledWidget
{
+ YIntField *m_yfield;
GtkWidget *m_spiner, *m_slider;
public:
- YGSpinBox (YWidget *y_widget, YGWidget *parent,
- const YWidgetOpt &opt, const YCPString &label,
- int minValue, int maxValue, int initialValue,
- bool show_slider)
- : YGLabeledWidget (y_widget, parent, label, YD_HORIZ, true,
+ YGSpinBox (YWidget *ywidget, YWidget *parent, const string &label,
+ int minValue, int maxValue, int initialValue, bool show_slider)
+ : YGLabeledWidget (ywidget, parent, label, YD_HORIZ, true,
GTK_TYPE_HBOX, NULL)
{
m_spiner = gtk_spin_button_new_with_range (minValue, maxValue, 1);
@@ -62,7 +61,12 @@
GtkHScale *getSlider()
{ return GTK_HSCALE (m_slider); }
- virtual void reportValue (int newValue) {}
+ virtual void reportValue (int value) = 0;
+
+ int doGetValue()
+ {
+ return gtk_spin_button_get_value_as_int (getSpiner());
+ }
void doSetValue (int newValue)
{
@@ -74,10 +78,10 @@
// Events callbacks
static void spiner_changed_cb (GtkSpinButton *widget, YGSpinBox *pThis)
{
- int newValue = gtk_spin_button_get_value_as_int (pThis->getSpiner());
- pThis->reportValue (newValue);
+ int value = gtk_spin_button_get_value_as_int (pThis->getSpiner());
+ pThis->reportValue (value);
if (pThis->useSlider())
- gtk_range_set_value (GTK_RANGE (pThis->getSlider()), newValue);
+ gtk_range_set_value (GTK_RANGE (pThis->getSlider()), value);
pThis->emitEvent (YEvent::ValueChanged);
}
@@ -91,12 +95,14 @@
};
#define YGSPIN_BOX_IMPL_SET_VALUE_CHAIN(ParentClass) \
- virtual void reportValue (int newValue) { \
- ParentClass::setValue (newValue); \
- } \
- virtual void setValue (int newValue) { \
- doSetValue (newValue); \
- reportValue (newValue); \
+ virtual void reportValue (int value) { \
+ ParentClass::setValue (value); \
+ } \
+ virtual int value() { \
+ return doGetValue(); \
+ } \
+ virtual void setValueInternal (int value) { \
+ doSetValue (value); \
}
#include "YIntField.h"
@@ -104,25 +110,21 @@
class YGIntField : public YIntField, public YGSpinBox
{
public:
- YGIntField (const YWidgetOpt &opt, YGWidget *parent, const YCPString &label,
- int minValue, int maxValue, int initialValue)
- : YIntField (opt, label, minValue, maxValue, initialValue)
- , YGSpinBox (this, parent, opt, label, minValue, maxValue, initialValue, false)
- { }
+ YGIntField (YWidget *parent, const string &label, int minValue, int maxValue,
+ int initialValue)
+ : YIntField (NULL, label, minValue, maxValue)
+ , YGSpinBox (this, parent, label, minValue, maxValue, initialValue, false)
+ {}
YGWIDGET_IMPL_COMMON
YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YIntField)
YGSPIN_BOX_IMPL_SET_VALUE_CHAIN (YIntField)
};
-YWidget *
-YGUI::createIntField (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label,
- int minValue, int maxValue, int initialValue)
+YIntField *YGWidgetFactory::createIntField (YWidget *parent, const string &label,
+ int minValue, int maxValue, int initialValue)
{
- IMPL
- return new YGIntField (opt, YGWidget::get (parent), label,
- minValue, maxValue, initialValue);
+ return new YGIntField (parent, label, minValue, maxValue, initialValue);
}
#include "YSlider.h"
@@ -130,23 +132,21 @@
class YGSlider : public YSlider, public YGSpinBox
{
public:
- YGSlider (const YWidgetOpt &opt, YGWidget *parent, const YCPString &label,
- int minValue, int maxValue, int initialValue)
- : YSlider (opt, label, minValue, maxValue, initialValue)
- , YGSpinBox (this, parent, opt, label, minValue, maxValue, initialValue, true)
- { }
+ YGSlider (YWidget *parent, const string &label, int minValue, int maxValue,
+ int initialValue)
+ : YSlider (NULL, label, minValue, maxValue)
+ , YGSpinBox (this, parent, label, minValue, maxValue, initialValue, true)
+ {}
YGWIDGET_IMPL_COMMON
YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YSlider)
- YGSPIN_BOX_IMPL_SET_VALUE_CHAIN (YSlider)
+ YGSPIN_BOX_IMPL_SET_VALUE_CHAIN (YIntField)
};
-YWidget *
-YGUI::createSlider (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label,
- int minValue, int maxValue, int initialValue)
+YSlider *YGOptionalWidgetFactory::createSlider (YWidget *parent, const string &label,
+ int minValue, int maxValue, int initialValue)
{
IMPL
- return new YGSlider (opt, YGWidget::get (parent), label,
- minValue, maxValue, initialValue);
+ return new YGSlider (parent, label, minValue, maxValue, initialValue);
}
+
Modified: trunk/gtk/src/YGLabel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLabel.cc?rev=43216&r1=…
==============================================================================
--- trunk/gtk/src/YGLabel.cc (original)
+++ trunk/gtk/src/YGLabel.cc Thu Dec 20 21:44:06 2007
@@ -13,85 +13,35 @@
class YGLabel : public YLabel, public YGWidget
{
public:
- YGLabel (const YWidgetOpt &opt, YGWidget *parent, YCPString text)
- : YLabel (opt, text),
+ YGLabel (YWidget *parent, const string &text, bool heading, bool outputField)
+ : YLabel (NULL, text, heading, outputField),
YGWidget (this, parent, true, GTK_TYPE_LABEL, NULL)
{
IMPL
gtk_misc_set_alignment (GTK_MISC (getWidget()), 0.0, 0.5);
- if (opt.isOutputField.value())
+ if (outputField)
gtk_label_set_selectable (GTK_LABEL (getWidget()), TRUE);
-
- if (opt.boldFont.value())
- YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
- if (opt.isHeading.value())
+ if (heading)
YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_ULTRABOLD, PANGO_SCALE_XX_LARGE);
setLabel (text);
}
- virtual void setLabel (const YCPString &label)
+ virtual void setText (const string &label)
{
- gtk_label_set_label (GTK_LABEL (getWidget()), label->value_cstr());
- YLabel::setLabel (label);
+ gtk_label_set_label (GTK_LABEL (getWidget()), label.c_str());
+ YLabel::setText (label);
// Some YCP progs have no labeled labels cluttering the layout
- label->value().empty() ? gtk_widget_hide (getWidget())
- : gtk_widget_show (getWidget());
+ label.empty() ? gtk_widget_hide (getWidget()) : gtk_widget_show (getWidget());
}
- // YWidget
- virtual bool doSetKeyboardFocus()
- { return false; }
YGWIDGET_IMPL_COMMON
+ YGWIDGET_IMPL_USE_BOLD (YLabel)
};
-YWidget *
-YGUI::createLabel (YWidget *parent, YWidgetOpt &opt,
- const YCPString &text)
+YLabel *YGWidgetFactory::createLabel (YWidget *parent, const string &text, bool heading,
+ bool outputField)
{
- return new YGLabel (opt, YGWidget::get (parent), text);
+ return new YGLabel (parent, text, heading, outputField);
}
-#include "YColoredLabel.h"
-#include "ygtkbargraph.h"
-
-class YGColoredLabel : public YColoredLabel, public YGWidget
-{
-public:
- YGColoredLabel (const YWidgetOpt &opt, YGWidget *parent, YCPString text,
- const YColor &fgColor, const YColor &bgColor, int margin)
- : YColoredLabel (opt, text),
- YGWidget (this, parent, true, YGTK_TYPE_COLORED_LABEL, NULL)
- {
- IMPL
- gtk_misc_set_alignment (GTK_MISC (getWidget()), 0.0, 0.5);
- gtk_misc_set_padding (GTK_MISC (getWidget()), margin, margin);
-
- if (opt.boldFont.value())
- YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
- if (opt.isHeading.value())
- YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_ULTRABOLD, PANGO_SCALE_XX_LARGE);
- setLabel (text);
-
- YGtkColoredLabel *color_label = YGTK_COLORED_LABEL (getWidget());
- ygtk_colored_label_set_shadow_type (color_label, GTK_SHADOW_OUT);
- ygtk_colored_label_set_foreground (color_label, fgColor.red, fgColor.green, fgColor.blue);
- ygtk_colored_label_set_background (color_label, bgColor.red, bgColor.green, bgColor.blue);
- }
-
- virtual void setLabel (const YCPString &label)
- {
- gtk_label_set_label (GTK_LABEL (getWidget()), label->value_cstr());
- YColoredLabel::setLabel (label);
- }
-
- YGWIDGET_IMPL_COMMON
-};
-
-YWidget *
-YGUI::createColoredLabel (YWidget *parent, YWidgetOpt &opt, YCPString label,
- YColor fgColor, YColor bgColor, int margin)
-{
- return new YGColoredLabel (opt, YGWidget::get (parent), label,
- fgColor, bgColor, margin);
-}
Modified: trunk/gtk/src/YGLayout.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=43216&r1…
==============================================================================
--- trunk/gtk/src/YGLayout.cc (original)
+++ trunk/gtk/src/YGLayout.cc Thu Dec 20 21:44:06 2007
@@ -4,16 +4,16 @@
#include <config.h>
#include <ycp/y2log.h>
-#include <YGUI.h>
+#include "YGUI.h"
#include "YGWidget.h"
#include "YGUtils.h"
-#include "YSplit.h"
+#include "YLayoutBox.h"
#include "ygtkratiobox.h"
#include "YSpacing.h"
// GtkBox-like container (actually, more like our YGtkRatioBox)
-class YGSplit : public YSplit, public YGWidget
+class YGLayoutBox : public YLayoutBox, public YGWidget
{
// This group is meant to set all YGLabeledWidget with horizontal label
// to share the same width (if they belong to the same YSplit), so they
@@ -21,48 +21,45 @@
GtkSizeGroup *m_labels_group;
public:
- YGSplit (const YWidgetOpt &opt, YGWidget *parent, YUIDimension dim)
- : YSplit (opt, dim),
+ YGLayoutBox (YWidget *parent, YUIDimension dim)
+ : YLayoutBox (NULL, dim),
YGWidget (this, parent, true,
- dim == YD_HORIZ ? YGTK_TYPE_RATIO_HBOX
- : YGTK_TYPE_RATIO_VBOX, NULL)
+ dim == YD_HORIZ ? YGTK_TYPE_RATIO_HBOX : YGTK_TYPE_RATIO_VBOX, NULL)
{
setBorder (0);
m_labels_group = NULL;
}
- ~YGSplit()
+ ~YGLayoutBox()
{
if (m_labels_group)
g_object_unref (G_OBJECT (m_labels_group));
}
- virtual void childAdded (YWidget *ychild)
+ virtual string getDebugLabel() const
+ { return primary() == YD_HORIZ ? "horizontal" : "vertical"; }
+
+ virtual void doAddChild (YWidget *ychild, GtkWidget *container)
{
IMPL
- YGWidget *ygchild = YGWidget::get (ychild);
-
- gtk_container_add (GTK_CONTAINER (getWidget()), ygchild->getLayout());
- sync_stretchable (ychild);
+ YGWidget::doAddChild (ychild, container);
// set labels of YGLabeledWidgets to the same width
// we have to do quite some work due to over-clutter on YCP progs
while (ychild) {
- if (ychild->isContainer()) {
+ if (ychild->hasChildren()) { // container
// try to see if there is a YGLabeledWidget at start
// (and ignore YSpacings)
- YContainerWidget *container = (YContainerWidget *) ychild;
- if (container->numChildren())
- for (int i = 0; i < container->numChildren(); i++) {
- ychild = container->child (i);
- if (!dynamic_cast <YSpacing *> (ychild))
- break;
- }
- else // no kids
- break;
+ YWidget *container = ychild;
+ for (YWidgetListConstIterator it = container->childrenBegin();
+ it != container->childrenEnd(); it++) {
+ ychild = *it;
+ if (!dynamic_cast <YSpacing *> (ychild))
+ break;
+ }
}
else {
- ygchild = YGWidget::get (ychild);
+ YGWidget *ygchild = YGWidget::get (ychild);
YGLabeledWidget *labeled_child = dynamic_cast <YGLabeledWidget *> (ygchild);
if (labeled_child && labeled_child->orientation() == YD_HORIZ) {
if (!m_labels_group)
@@ -74,6 +71,8 @@
}
}
}
+
+ YGWIDGET_IMPL_CHILD_ADDED (getWidget())
YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
virtual void sync_stretchable (YWidget *ychild)
@@ -82,28 +81,24 @@
YGtkRatioBox *box = YGTK_RATIO_BOX (getWidget());
YGWidget *child = YGWidget::get (ychild);
- YUIDimension dim = dimension();
- bool horiz_fill = child->isStretchable (YD_HORIZ)
- || ychild->hasWeight (YD_HORIZ);
- bool vert_fill = child->isStretchable (YD_VERT)
- || ychild->hasWeight (YD_VERT);
+ YUIDimension dim = primary();
+ bool horiz_fill = ychild->stretchable (YD_HORIZ) || ychild->hasWeight (YD_HORIZ);
+ bool vert_fill = ychild->stretchable (YD_VERT) || ychild->hasWeight (YD_VERT);
ygtk_ratio_box_set_child_packing (box, child->getLayout(), ychild->weight (dim),
horiz_fill, vert_fill, 0);
ygtk_ratio_box_set_child_expand (box, child->getLayout(),
- child->isStretchable (dim),
- ychild->isLayoutStretch (dim));
+ ychild->stretchable (dim), isLayoutStretch (ychild, dim));
YGWidget::sync_stretchable();
}
- virtual void moveChild (YWidget *, long, long) {} // ignore
+ virtual void moveChild (YWidget *, int, int) {} // ignore
};
-YContainerWidget *
-YGUI::createSplit (YWidget *parent, YWidgetOpt &opt, YUIDimension dimension)
+YLayoutBox *YGWidgetFactory::createLayoutBox (YWidget *parent, YUIDimension dimension)
{
IMPL
- return new YGSplit (opt, YGWidget::get (parent), dimension);
+ return new YGLayoutBox (parent, dimension);
}
#include "YAlignment.h"
@@ -113,9 +108,8 @@
GdkPixbuf *m_background_pixbuf;
public:
- YGAlignment (const YWidgetOpt &opt, YGWidget *parent,
- YAlignmentType halign, YAlignmentType valign)
- : YAlignment (opt, halign, valign),
+ YGAlignment (YWidget *parent, YAlignmentType halign, YAlignmentType valign)
+ : YAlignment (NULL, halign, valign),
YGWidget (this, parent, true, GTK_TYPE_ALIGNMENT, NULL)
{
setBorder (0);
@@ -128,50 +122,41 @@
g_object_unref (G_OBJECT (m_background_pixbuf));
}
- virtual void childAdded (YWidget *ychild)
+ virtual void doAddChild (YWidget *ychild, GtkWidget *container)
{
- YGWidget *child = YGWidget::get (ychild);
- gtk_container_add (GTK_CONTAINER (getWidget()), child->getLayout());
+ YGWidget::doAddChild (ychild, container);
/* The padding is used for stuff like making YCP progs nicer for
yast-qt wizard, so it hurts us -- it's disabled. */
//child->setPadding (topMargin(), bottomMargin(),
// leftMargin(), rightMargin());
setMinSize (minWidth(), minHeight());
-
- sync_stretchable (ychild); // alignment will be set here
}
+ YGWIDGET_IMPL_CHILD_ADDED (m_widget)
YGWIDGET_IMPL_CHILD_REMOVED (m_widget)
virtual void sync_stretchable (YWidget *child)
{
IMPL
- setAlignment (align [YD_HORIZ], align [YD_VERT]);
- YGWidget::sync_stretchable (m_y_widget);
+ setAlignment (alignment (YD_HORIZ), alignment (YD_VERT));
+ YGWidget::sync_stretchable();
}
void setAlignment (YAlignmentType halign, YAlignmentType valign)
{
- // special case (which YAlignment.cc also uses); let stretchable
- // children stretch if opt.stretch is set (exploitable by the wizard)
- GValue hstretch, vstretch;
- hstretch = YGUtils::floatToGValue (0);
- if (_stretch [YD_HORIZ] && YGWidget::get (child (0))->isStretchable (YD_HORIZ))
- hstretch = YGUtils::floatToGValue (1);
- vstretch = YGUtils::floatToGValue (0);
- if (_stretch [YD_VERT] && YGWidget::get (child (0))->isStretchable (YD_VERT))
- vstretch = YGUtils::floatToGValue (1);
-
- if (halign != YAlignUnchanged) {
- GValue xalign = YGUtils::floatToGValue (yToGtkAlign (halign));
- g_object_set_property (G_OBJECT (getWidget()), "xalign", &xalign);
- g_object_set_property (G_OBJECT (getWidget()), "xscale", &hstretch);
- }
- if (valign != YAlignUnchanged) {
- GValue yalign = YGUtils::floatToGValue (yToGtkAlign (valign));
- g_object_set_property (G_OBJECT (getWidget()), "yalign", &yalign);
- g_object_set_property (G_OBJECT (getWidget()), "yscale", &vstretch);
- }
+ bool hstretch = halign == YAlignUnchanged || stretchable (YD_HORIZ);
+ bool vstretch = valign == YAlignUnchanged || stretchable (YD_VERT);
+
+ GValue xalign, yalign, xscale, yscale;
+ xalign = YGUtils::floatToGValue (yToGtkAlign (halign));
+ yalign = YGUtils::floatToGValue (yToGtkAlign (valign));
+ xscale = YGUtils::floatToGValue (hstretch ? 1 : 0);
+ yscale = YGUtils::floatToGValue (vstretch ? 1 : 0);
+
+ g_object_set_property (G_OBJECT (getWidget()), "xalign", &xalign);
+ g_object_set_property (G_OBJECT (getWidget()), "yalign", &yalign);
+ g_object_set_property (G_OBJECT (getWidget()), "xscale", &xscale);
+ g_object_set_property (G_OBJECT (getWidget()), "yscale", &yscale);
}
void setPadding (int top, int bottom, int left, int right)
@@ -225,7 +210,7 @@
return TRUE;
}
- virtual void moveChild (YWidget *, long, long) {}; // ignore
+ virtual void moveChild (YWidget *, int, int) {}; // ignore
virtual string getDebugLabel() const
{
@@ -247,9 +232,9 @@
};
string str;
- str += inner::alignLabel (align [YD_HORIZ]);
+ str += inner::alignLabel (alignment (YD_HORIZ));
str += " x ";
- str += inner::alignLabel (align [YD_VERT]);
+ str += inner::alignLabel (alignment (YD_VERT));
return str;
}
@@ -266,12 +251,11 @@
}
};
-YContainerWidget *
-YGUI::createAlignment (YWidget *parent, YWidgetOpt &opt,
- YAlignmentType halign, YAlignmentType valign)
+YAlignment *YGWidgetFactory::createAlignment (YWidget *parent, YAlignmentType halign,
+ YAlignmentType valign)
{
IMPL
- return new YGAlignment (opt, YGWidget::get (parent), halign, valign);
+ return new YGAlignment (parent, halign, valign);
}
#include "YEmpty.h"
@@ -280,19 +264,20 @@
class YGEmpty : public YEmpty, public YGWidget
{
public:
- YGEmpty (const YWidgetOpt &opt, YGWidget *parent)
- : YEmpty (opt),
+ YGEmpty (YWidget *parent)
+ : YEmpty (NULL),
YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
{
setBorder (0);
}
+
+ YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createEmpty (YWidget *parent, YWidgetOpt &opt)
+YEmpty *YGWidgetFactory::createEmpty (YWidget *parent)
{
IMPL
- return new YGEmpty (opt, YGWidget::get (parent));
+ return new YGEmpty (parent);
}
#include "YSpacing.h"
@@ -301,32 +286,35 @@
class YGSpacing : public YSpacing, public YGWidget
{
public:
- YGSpacing (const YWidgetOpt &opt, YGWidget *parent,
- float size, bool horizontal, bool vertical)
- : YSpacing (opt, size, horizontal, vertical),
+ YGSpacing (YWidget *parent, YUIDimension dim, bool stretchable, YLayoutSize_t size)
+ : YSpacing (NULL, dim, stretchable, size),
YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
{
setBorder (0);
- gtk_widget_set_size_request (getWidget(), width(), height());
+ int width = YSpacing::size (YD_HORIZ), height = YSpacing::size (YD_VERT);
+ gtk_widget_set_size_request (getWidget(), width, height);
}
+
+ YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createSpacing (YWidget *parent, YWidgetOpt & opt, float size,
- bool horiz, bool vert)
+YSpacing *YGWidgetFactory::createSpacing (YWidget *parent, YUIDimension dim,
+ bool stretchable, YLayoutSize_t size)
{
- IMPL
- return new YGSpacing (opt, YGWidget::get (parent), size, horiz, vert);
+ return new YGSpacing (parent, dim, stretchable, size);
}
#include "YReplacePoint.h"
+//TEMP:
+#include "YPushButton.h"
+
// an empty space that will get replaced
class YGReplacePoint : public YReplacePoint, public YGWidget
{
public:
- YGReplacePoint (const YWidgetOpt &opt, YGWidget *parent)
- : YReplacePoint (opt),
+ YGReplacePoint (YWidget *parent)
+ : YReplacePoint (NULL),
YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
{
setBorder (0);
@@ -336,11 +324,10 @@
YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
};
-YContainerWidget *
-YGUI::createReplacePoint( YWidget *parent, YWidgetOpt & opt )
+YReplacePoint *YGWidgetFactory::createReplacePoint (YWidget *parent)
{
IMPL
- return new YGReplacePoint (opt, YGWidget::get (parent));
+ return new YGReplacePoint (parent);
}
#include "YSquash.h"
@@ -350,9 +337,8 @@
class YGSquash : public YSquash, public YGWidget
{
public:
- YGSquash (const YWidgetOpt &opt, YGWidget *parent,
- bool hsquash, bool vsquash)
- : YSquash (opt, hsquash, vsquash),
+ YGSquash (YWidget *parent, bool hsquash, bool vsquash)
+ : YSquash (NULL, hsquash, vsquash),
YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
{
setBorder (0);
@@ -362,10 +348,9 @@
YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
};
-YContainerWidget *
-YGUI::createSquash (YWidget *parent, YWidgetOpt &opt,
- bool hsquash, bool vsquash)
+YSquash *YGWidgetFactory::createSquash (YWidget *parent, bool hsquash, bool vsquash)
{
IMPL
- return new YGSquash (opt, YGWidget::get (parent), hsquash, vsquash);
+ return new YGSquash (parent, hsquash, vsquash);
}
+
Modified: trunk/gtk/src/YGMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGMenuButton.cc?rev=4321…
==============================================================================
--- trunk/gtk/src/YGMenuButton.cc (original)
+++ trunk/gtk/src/YGMenuButton.cc Thu Dec 20 21:44:06 2007
@@ -13,48 +13,48 @@
class YGMenuButton : public YMenuButton, public YGWidget
{
public:
- YGMenuButton (const YWidgetOpt &opt,
- YGWidget *parent,
- YCPString label)
- : YMenuButton (opt, label),
+ YGMenuButton (YWidget *parent, const string &label)
+ : YMenuButton (NULL, label),
YGWidget (this, parent, true, YGTK_TYPE_MENU_BUTTON, NULL)
{
IMPL
- setLabel (label);
- }
-
- virtual ~YGMenuButton() {}
-
- // YMenuButton
- virtual void setLabel (const YCPString &label)
- {
- IMPL
- string str = YGUtils::mapKBAccel (label->value_cstr());
+ string str = YGUtils::mapKBAccel (label.c_str());
ygtk_menu_button_set_label (YGTK_MENU_BUTTON (getWidget()), str.c_str());
- YMenuButton::setLabel (label);
}
// YMenuButton
- virtual void createMenu()
+ virtual void rebuildMenuTree()
{
- GtkWidget *menu = doCreateMenu (getToplevelMenu()->itemList());
+ GtkWidget *menu = doCreateMenu (itemsBegin(), itemsEnd());
gtk_widget_show_all (menu);
ygtk_menu_button_set_popup (YGTK_MENU_BUTTON (getWidget()), menu);
}
- static GtkWidget* doCreateMenu (YMenuItemList &items)
+ static GtkWidget* doCreateMenu (YItemIterator begin, YItemIterator end)
{
GtkWidget *menu = gtk_menu_new();
- for (YMenuItemListIterator it = items.begin(); it != items.end(); it++) {
- GtkWidget *entry;
- string str = YGUtils::mapKBAccel ((*it)->getLabel()->value_cstr());
- entry = gtk_menu_item_new_with_mnemonic (str.c_str());
+ for (YItemIterator it = begin; it != end; it++) {
+ GtkWidget *entry, *image = 0;
+ string str = YGUtils::mapKBAccel ((*it)->label());
+
+ if ((*it)->hasIconName()) {
+ GdkPixbuf *pixbuf = YGUtils::loadPixbuf ((*it)->iconName());
+ if (pixbuf)
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ }
+
+ if (image) {
+ entry = gtk_image_menu_item_new_with_mnemonic (str.c_str());
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (entry), image);
+ }
+ else
+ entry = gtk_menu_item_new_with_mnemonic (str.c_str());
gtk_menu_shell_append (GTK_MENU_SHELL (menu), entry);
if ((*it)->hasChildren())
gtk_menu_item_set_submenu (GTK_MENU_ITEM (entry),
- doCreateMenu ((*it)->itemList()));
+ doCreateMenu ((*it)->childrenBegin(), (*it)->childrenEnd()));
else
g_signal_connect (G_OBJECT (entry), "activate",
G_CALLBACK (selected_item_cb), *it);
@@ -63,17 +63,16 @@
return menu;
}
- static void selected_item_cb (GtkMenuItem *menuitem, YMenuItem *yitem)
+ static void selected_item_cb (GtkMenuItem *menuitem, YItem *item)
{
- YGUI::ui()->sendEvent (new YMenuEvent (yitem->getId()));
+ YGUI::ui()->sendEvent (new YMenuEvent (item));
}
YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createMenuButton (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label)
+YMenuButton *YGWidgetFactory::createMenuButton (YWidget *parent, const string &label)
{
- return new YGMenuButton (opt, YGWidget::get (parent), label);
+ return new YGMenuButton (parent, label);
}
+
Modified: trunk/gtk/src/YGMultiLineEdit.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGMultiLineEdit.cc?rev=4…
==============================================================================
--- trunk/gtk/src/YGMultiLineEdit.cc (original)
+++ trunk/gtk/src/YGMultiLineEdit.cc Thu Dec 20 21:44:06 2007
@@ -14,19 +14,15 @@
int maxChars;
public:
- YGTextView (YWidget *y_widget, YGWidget *parent, const YWidgetOpt &opt,
- const YCPString &label, const YCPString &text, bool editable)
- : YGScrolledWidget (y_widget, parent, label, YD_VERT, true,
+ YGTextView (YWidget *ywidget, YWidget *parent, const string &label, bool editable)
+ : YGScrolledWidget (ywidget, parent, label, YD_VERT, true,
GTK_TYPE_TEXT_VIEW, "wrap-mode", GTK_WRAP_WORD, NULL)
{
IMPL
- if (!opt.isShrinkable.value())
- setMinSizeInChars (20, 10);
+ setMinSizeInChars (20, 10);
setPolicy (GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
maxChars = -1;
- setText (text);
-
if (!editable)
{
gtk_text_view_set_editable (GTK_TEXT_VIEW (getWidget()), FALSE);
@@ -66,20 +62,20 @@
g_signal_handlers_unblock_by_func (getWidget(), (gpointer) text_changed_cb, this);
}
- void setText (const YCPString &text)
+ void setText (const string &text)
{
IMPL
- gtk_text_buffer_set_text (getBuffer(), text->value_cstr(), -1);
+ gtk_text_buffer_set_text (getBuffer(), text.c_str(), -1);
}
- YCPString getText()
+ string getText()
{
IMPL
GtkTextIter start_it, end_it;
gtk_text_buffer_get_bounds (getBuffer(), &start_it, &end_it);
gchar* text = gtk_text_buffer_get_text (getBuffer(), &start_it, &end_it, FALSE);
- YCPString str (text);
+ string str (text);
g_free (text);
return str;
}
@@ -105,31 +101,31 @@
class YGMultiLineEdit : public YMultiLineEdit, public YGTextView
{
public:
- YGMultiLineEdit (const YWidgetOpt &opt, YGWidget *parent,
- const YCPString &label, const YCPString &text)
- : YMultiLineEdit (opt, label)
- , YGTextView (this, parent, opt, label, text, true)
- { }
+ YGMultiLineEdit (YWidget *parent, const string &label)
+ : YMultiLineEdit (NULL, label)
+ , YGTextView (this, parent, label, true)
+ {}
// YMultiLineEdit
- virtual void setText (const YCPString &text)
+ virtual void setValue (const string &text)
{ YGTextView::setText (text); }
- virtual YCPString text()
+ virtual string value()
{ return YGTextView::getText(); }
- virtual void setInputMaxLength (const YCPInteger &numberOfChars)
- { YGTextView::setCharsNb (numberOfChars->asInteger()->value()); }
+ virtual void setInputMaxLength (int nb)
+ {
+ YGTextView::setCharsNb (nb);
+ YMultiLineEdit::setInputMaxLength (nb);
+ }
YGWIDGET_IMPL_COMMON
YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YMultiLineEdit)
};
-YWidget *
-YGUI::createMultiLineEdit (YWidget *parent, YWidgetOpt & opt,
- const YCPString & label, const YCPString & text)
+YMultiLineEdit *YGWidgetFactory::createMultiLineEdit (YWidget *parent, const string &label)
{
- return new YGMultiLineEdit (opt, YGWidget::get (parent), label, text);
+ return new YGMultiLineEdit (parent, label);
}
#include "YLogView.h"
@@ -137,16 +133,13 @@
class YGLogView : public YLogView, public YGTextView
{
public:
- YGLogView (const YWidgetOpt &opt, YGWidget *parent,
- const YCPString &label, int visibleLines, int maxLines)
- : YLogView (opt, label, visibleLines, maxLines)
- , YGTextView (this, parent, opt, label, YCPString(""), false)
- {
- setMinSizeInChars (0, visibleLines);
- }
+ YGLogView (YWidget *parent, const string &label, int visibleLines, int maxLines)
+ : YLogView (NULL, label, visibleLines, maxLines)
+ , YGTextView (this, parent, label, false)
+ {}
// YLogView
- virtual void setLogText (const YCPString &text)
+ virtual void displayLogText (const string &text)
{
setText (text);
scrollToBottom();
@@ -156,13 +149,10 @@
YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YLogView)
};
-YWidget *
-YGUI::createLogView (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, int visibleLines,
- int maxLines)
+YLogView *YGWidgetFactory::createLogView (YWidget *parent, const string &label,
+ int visibleLines, int maxLines)
{
- return new YGLogView (opt, YGWidget::get (parent),
- label, visibleLines, maxLines);
+ return new YGLogView (parent, label, visibleLines, maxLines);
}
#include "YRichText.h"
@@ -172,22 +162,22 @@
bool m_autoScrollDown;
public:
- YGPlainText(const YWidgetOpt &opt, YGWidget *parent, const YCPString &text)
- : YRichText (opt, text)
- , YGTextView (this, parent, opt, YCPString(""), text, false)
+ YGPlainText(YWidget *parent, const string &text)
+ : YRichText (NULL, text)
+ , YGTextView (this, parent, string(), false)
{
- IMPL
- m_autoScrollDown = opt.autoScrollDown.value();
+ if (shrinkable())
+ setMinSizeInChars (0, 0);
}
// YRichText
- virtual void setText (const YCPString &text)
+ virtual void setValue (const string &text)
{
IMPL
YGTextView::setText (text);
- if (m_autoScrollDown)
+ if (autoScrollDown())
scrollToBottom();
- YRichText::setText (text);
+ YRichText::setValue (text);
}
YGWIDGET_IMPL_COMMON
@@ -197,35 +187,31 @@
class YGRichText : public YRichText, public YGScrolledWidget
{
-bool m_autoScrollDown;
-
public:
- YGRichText(const YWidgetOpt &opt, YGWidget *parent, const YCPString &text)
- : YRichText (opt, text)
+ YGRichText (YWidget *parent, const string &text)
+ : YRichText (NULL, text)
, YGScrolledWidget (this, parent, true, ygtk_html_wrap_get_type(), NULL)
{
IMPL
- if (!opt.isShrinkable.value())
+ if (!shrinkable())
setMinSizeInChars (20, 8);
- m_autoScrollDown = opt.autoScrollDown.value();
ygtk_html_wrap_init (getWidget());
ygtk_html_wrap_connect_link_clicked (getWidget(), G_CALLBACK (link_clicked_cb), this);
-
- setText (text);
+ setValue (text);
}
// YRichText
- virtual void setText (const YCPString &_text)
+ virtual void setValue (const string &_text)
{
IMPL
- string text (_text->value());
+ string text (_text);
YGUtils::replace (text, "&product;", 9, YUI::ui()->productName().c_str());
ygtk_html_wrap_set_text (getWidget(), text.c_str());
- if (m_autoScrollDown)
+ if (autoScrollDown())
ygtk_html_wrap_scroll (getWidget(), FALSE);
- YRichText::setText (_text);
+ YRichText::setValue (_text);
}
static void link_clicked_cb (GtkWidget *widget, const char *url, YGRichText *pThis)
@@ -236,13 +222,13 @@
YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createRichText (YWidget *parent, YWidgetOpt &opt, const YCPString &text)
+YRichText *YGWidgetFactory::createRichText (YWidget *parent, const string &text,
+ bool plainTextMode)
{
- if (opt.plainTextMode.value())
- return new YGPlainText (opt, YGWidget::get (parent), text);
+ if (plainTextMode)
+ return new YGPlainText (parent, text);
else
- return new YGRichText (opt, YGWidget::get (parent), text);
+ return new YGRichText (parent, text);
}
#if 0
Modified: trunk/gtk/src/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev…
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Thu Dec 20 21:44:06 2007
@@ -10,8 +10,11 @@
#include "YGi18n.h"
#include "YGDialog.h"
+#if 1
#include "ygtkwizard.h"
#include "ygtkfindentry.h"
+#include "ygtkscrolledwindow.h"
+#include "ygtktogglebutton.h"
#include "ygtkhtmlwrap.h"
#include "ygtkzyppwrapper.h"
@@ -25,9 +28,9 @@
return image;
}
-#define FILEMANAGER_EXEC "/usr/bin/nautilus"
+#define FILEMANAGER_EXEC "/usr/bin/nautilus -n --no-desktop"
inline void FILEMANAGER_LAUNCH (const char *path)
-{ system ((std::string (FILEMANAGER_EXEC) + " -n --no-desktop " + path + " &").c_str()); }
+{ system ((std::string (FILEMANAGER_EXEC) + " " + path + " &").c_str()); }
static void busyCursor()
{
@@ -93,23 +96,24 @@
{
GtkTreeView *view = GTK_TREE_VIEW (m_widget = gtk_tree_view_new());
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (view), 1);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (view), YGtkZyppModel::NAME_COLUMN);
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
renderer = gtk_cell_renderer_pixbuf_new();
column = gtk_tree_view_column_new_with_attributes ("", renderer,
"pixbuf", YGtkZyppModel::ICON_COLUMN, NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 38);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
renderer = gtk_cell_renderer_text_new();
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
column = gtk_tree_view_column_new_with_attributes ("", renderer,
"markup", YGtkZyppModel::NAME_DESCRIPTION_COLUMN, NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 50 /* it will expand */);
gtk_tree_view_column_set_expand (column, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
- renderer = gtk_cell_renderer_pixbuf_new();
- column = gtk_tree_view_column_new_with_attributes ("", renderer,
- "pixbuf", YGtkZyppModel::SPECIAL_ICON_COLUMN, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
@@ -165,41 +169,25 @@
}
};
-GtkWidget *m_box, *m_bin, *m_list_button, *m_icon_button;
+GtkWidget *m_bin;
GtkTreeModel *m_model;
View *m_view;
public:
GtkWidget *getWidget()
- { return m_box; }
+ { return m_bin; }
PackagesView() : m_listener (NULL), m_model (NULL), m_view (NULL)
{
- m_bin = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (m_bin),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_bin),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
- GtkWidget *buttons = gtk_vbox_new (FALSE, 0), *image;
- image = createImageFromXPM (pkg_list_mode_xpm);
- m_list_button = gtk_toggle_button_new();
- gtk_button_set_image (GTK_BUTTON (m_list_button), image);
- image = createImageFromXPM (pkg_tiles_mode_xpm);
- m_icon_button = gtk_toggle_button_new();
- gtk_button_set_image (GTK_BUTTON (m_icon_button), image);
- gtk_box_pack_start (GTK_BOX (buttons), gtk_label_new(""), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (buttons), m_list_button, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (buttons), m_icon_button, FALSE, FALSE, 0);
- g_signal_connect (G_OBJECT (m_list_button), "toggled",
- G_CALLBACK (mode_toggled_cb), this);
- g_signal_connect (G_OBJECT (m_icon_button), "toggled",
- G_CALLBACK (mode_toggled_cb), this);
-
- m_box = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (m_box), m_bin, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_box), buttons, FALSE, TRUE, 0);
+ GtkWidget *buttons = gtk_vbox_new (FALSE, 0), *button;
+ button = create_toggle_button (pkg_list_mode_xpm, "List view", NULL);
+ gtk_box_pack_start (GTK_BOX (buttons), button, FALSE, TRUE, 0);
+ button = create_toggle_button (pkg_tiles_mode_xpm, "Tiles view", button);
+ gtk_box_pack_start (GTK_BOX (buttons), button, FALSE, TRUE, 0);
+ gtk_widget_show_all (buttons);
+ m_bin = ygtk_scrolled_window_new();
+ ygtk_scrolled_window_set_corner_widget (YGTK_SCROLLED_WINDOW (m_bin), buttons);
setMode (LIST_MODE);
}
@@ -217,14 +205,6 @@
{
if (GTK_WIDGET_REALIZED (m_bin))
busyCursor();
- g_signal_handlers_block_by_func (m_list_button, (gpointer) mode_toggled_cb, this);
- g_signal_handlers_block_by_func (m_icon_button, (gpointer) mode_toggled_cb, this);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_list_button), mode == LIST_MODE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_icon_button), mode == ICON_MODE);
-
- g_signal_handlers_unblock_by_func (m_list_button, (gpointer) mode_toggled_cb, this);
- g_signal_handlers_unblock_by_func (m_icon_button, (gpointer) mode_toggled_cb, this);
if (m_view)
gtk_container_remove (GTK_CONTAINER (m_bin), m_view->m_widget);
@@ -233,15 +213,15 @@
m_view = new ListView (this);
else
m_view = new IconView (this);
-fprintf (stderr, "adding new view to container\n");
gtk_container_add (GTK_CONTAINER (m_bin), m_view->m_widget);
if (m_model)
m_view->setModel (m_model);
+
packagesSelected (std::list <Ypp::Package *> ());
normalCursor();
}
- void query (Ypp::Query *query)
+ void setQuery (Ypp::Query *query)
{
if (GTK_WIDGET_REALIZED (m_bin))
busyCursor();
@@ -259,90 +239,555 @@
}
private:
- static void mode_toggled_cb (GtkToggleButton *toggle, PackagesView *pThis)
+ GtkWidget *create_toggle_button (const char **xpm, const char *tooltip, GtkWidget *member)
{
- bool active = gtk_toggle_button_get_active (toggle);
- if (!active) {
- // don't let the button be un-pressed
- g_signal_handlers_block_by_func (toggle, (gpointer) mode_toggled_cb, pThis);
- gtk_toggle_button_set_active (toggle, TRUE);
- g_signal_handlers_unblock_by_func (toggle, (gpointer) mode_toggled_cb, pThis);
- return;
- }
- ViewMode mode = GTK_WIDGET (toggle) == pThis->m_list_button ? LIST_MODE : ICON_MODE;
+ GSList *group = NULL;
+ if (member)
+ group = ygtk_toggle_button_get_group (YGTK_TOGGLE_BUTTON (member));
+ GtkWidget *button = ygtk_toggle_button_new (group);
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+ gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
+ if (!member)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+
+ // make it tiny
+ GtkRcStyle *rcstyle = gtk_rc_style_new();
+ rcstyle->xthickness = rcstyle->ythickness = 0;
+ gtk_widget_modify_style (button, rcstyle);
+ gtk_rc_style_unref (rcstyle),
+
+ gtk_widget_set_tooltip_text (button, tooltip);
+ g_signal_connect (G_OBJECT (button), "toggle-changed",
+ G_CALLBACK (mode_toggled_cb), this);
+
+ GtkWidget *image = createImageFromXPM (xpm);
+ gtk_container_add (GTK_CONTAINER (button), image);
+ return button;
+ }
+
+ static void mode_toggled_cb (GtkToggleButton *toggle, gint nb, PackagesView *pThis)
+ {
+ ViewMode mode = (nb == 0) ? LIST_MODE : ICON_MODE;
pThis->setMode (mode);
}
};
-// TEMP: a window of modified packages
-class TrashWindow : PackagesView::Listener
+class ChangesPane : public Ypp::Pool::Listener
{
-GtkWidget *m_window, *m_undo_button;
-PackagesView *m_view;
+ 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_set_size_request (m_box, 140, -1);
+ gtk_widget_show_all (m_box);
+ modified (package);
+ g_signal_connect (G_OBJECT (m_label), "style-set",
+ G_CALLBACK (style_set_cb), NULL);
+ g_signal_connect (G_OBJECT (m_button), "clicked",
+ G_CALLBACK (undo_clicked_cb), package);
+ }
+
+ void modified (Ypp::Package *package)
+ {
+ std::string text;
+ if (package->isInstalled() && package->toInstall())
+ text = "upgrade";
+ else if (package->toInstall())
+ text = "install";
+ else
+ text = "remove";
+ text += " " + 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());
+ }
+
+ static void undo_clicked_cb (GtkButton *button, Ypp::Package *package)
+ {
+ package->undo();
+ }
+
+ static void style_set_cb (GtkWidget *widget, GtkStyle *prev_style)
+ {
+ static bool set_style = false;
+ if (set_style)
+ return;
+ set_style = true;
+ GdkColor *color = &widget->style->fg [GTK_STATE_SELECTED];
+ gtk_widget_modify_fg (widget, GTK_STATE_NORMAL, color);
+ set_style = false;
+ }
+ };
+
+GtkWidget *m_box, *m_entries_box, *m_container;
+Ypp::Pool *m_pool;
+GList *m_entries;
public:
- TrashWindow()
+ GtkWidget *getWidget()
+ { return m_box; }
+
+ ChangesPane()
+ : m_entries (NULL)
{
- m_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (m_window), "Changes");
- gtk_window_set_default_size (GTK_WINDOW (m_window), 200, 250);
+ GtkWidget *heading = gtk_label_new (_("Changes:"));
+ YGUtils::setWidgetFont (heading, PANGO_WEIGHT_ULTRABOLD, PANGO_SCALE_LARGE);
+ gtk_misc_set_alignment (GTK_MISC (heading), 0, 0.5);
+ g_signal_connect (G_OBJECT (heading), "style-set",
+ G_CALLBACK (Entry::style_set_cb), NULL);
+ m_entries_box = gtk_vbox_new (FALSE, 4);
+
+ GtkWidget *port = gtk_viewport_new (NULL, NULL);
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (port), GTK_SHADOW_NONE);
+ gtk_container_add (GTK_CONTAINER (port), m_entries_box);
+
+ GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (scroll), port);
+
+ 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);
+
+ m_box = gtk_event_box_new();
+ gtk_container_add (GTK_CONTAINER (m_box), vbox);
+ g_signal_connect_after (G_OBJECT (m_box), "style-set",
+ G_CALLBACK (style_set_cb), NULL);
+ g_signal_connect_after (G_OBJECT (scroll), "style-set",
+ G_CALLBACK (style_set_cb), NULL);
+ g_signal_connect_after (G_OBJECT (port), "style-set",
+ G_CALLBACK (style_set_cb), NULL);
- m_view = new PackagesView();
- Ypp::Query *query = new Ypp::Query (Ypp::Package::PACKAGE_TYPE);
+ Ypp::Query *query = new Ypp::Query();
query->setIsModified (true);
- m_view->query (query);
- m_view->setListener (this);
+ m_pool = new Ypp::Pool (query);
+ m_pool->setListener (this);
+ }
- GtkWidget *vbox = gtk_vbox_new (FALSE, 6), *undo_align;
- m_undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
- gtk_widget_set_sensitive (m_undo_button, FALSE);
- g_signal_connect (G_OBJECT (m_undo_button), "clicked",
- G_CALLBACK (undo_clicked_cb), this);
- undo_align = gtk_alignment_new (1, 0, 0, 0);
- gtk_container_add (GTK_CONTAINER (undo_align), m_undo_button);
+ ~ChangesPane()
+ {
+ delete m_pool;
+ for (GList *i = m_entries; i; i = i->next)
+ delete (Entry *) i->data;
+ g_list_free (m_entries);
+ }
- gtk_box_pack_start (GTK_BOX (vbox), m_view->getWidget(), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), undo_align, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (m_window), vbox);
- gtk_widget_show_all (m_window);
+ void setContainer (GtkWidget *container)
+ {
+ m_container = container;
+ gtk_widget_hide (m_container);
}
- ~TrashWindow()
+ virtual void entryInserted (Ypp::Pool::Iter iter, Ypp::Package *package)
{
- delete m_view;
- gtk_widget_destroy (m_window);
+ Entry *entry = new Entry (package);
+ gtk_box_pack_start (GTK_BOX (m_entries_box), entry->getWidget(), FALSE, TRUE, 0);
+ int index = m_pool->getIndex (iter);
+ m_entries = g_list_insert (m_entries, entry, index);
+ gtk_widget_show (m_container);
}
-private:
-std::list <Ypp::Package *> m_selection;
+ virtual void entryDeleted (Ypp::Pool::Iter iter, Ypp::Package *package)
+ {
+ int index = m_pool->getIndex (iter);
+ 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);
+ if (m_entries == NULL)
+ gtk_widget_hide (m_container);
+ }
- virtual void packagesSelected (const std::list <Ypp::Package *> &selection)
+ virtual void entryChanged (Ypp::Pool::Iter iter, Ypp::Package *package)
{
- gtk_widget_set_sensitive (m_undo_button, !selection.empty());
- m_selection = selection;
+ int index = m_pool->getIndex (iter);
+ Entry *entry = (Entry *) g_list_nth_data (m_entries, index);
+ entry->modified (package);
}
- static void undo_clicked_cb (GtkButton *button, TrashWindow *pThis)
+ static void style_set_cb (GtkWidget *widget, GtkStyle *prev_style)
{
- for (std::list <Ypp::Package *>::iterator it = pThis->m_selection.begin();
- it != pThis->m_selection.end(); it++)
- (*it)->undo();
+ static bool set_style = false;
+ if (set_style)
+ return;
+ set_style = true;
+ GdkColor *color = &widget->style->bg [GTK_STATE_SELECTED];
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
+ set_style = false;
}
};
-#include "icons/cat-development.xpm"
-#include "icons/cat-documentation.xpm"
-#include "icons/cat-emulators.xpm"
-#include "icons/cat-games.xpm"
-#include "icons/cat-hardware.xpm"
-#include "icons/cat-network.xpm"
-#include "icons/cat-multimedia.xpm"
-#include "icons/cat-office.xpm"
-#include "icons/cat-system.xpm"
-#include "icons/cat-utilities.xpm"
+// Maps icons to top package groups
+struct CategoriesIconMap {
+ const char *category, *icon;
+};
+static const CategoriesIconMap catIconMap[] = {
+ { "Amusements", "package_games" },
+ { "Games", "package_games" },
+ { "Development", "package_development" },
+ { "Libraries", "package_development" },
+ { "Documentation", "package_documentation" },
+ { "Hardware", "package_settings_peripherals" },
+ { "Applications", "package_applications" },
+ { "Productivity", "package_applications" },
+ { "System", "package_system" },
+ { "X11", "package_system" },
+ { "Multimedia", "package_multimedia" },
+ { "Video", "package_multimedia" },
+ { "Office", "package_office_documentviewer" },
+};
+#define CAT_SIZE (sizeof (catIconMap)/sizeof (CategoriesIconMap))
+
+#include "icons/pkg-installed.xpm"
+#include "icons/pkg-installed-upgradable.xpm"
+#include "icons/pkg-available.xpm"
class Filters
{
+ class Collections
+ {
+ struct View
+ {
+ virtual GtkWidget *getWidget() = 0;
+ virtual void writeQuery (Ypp::Query *query) = 0;
+
+ Filters *m_filters;
+ View (Filters *filters)
+ : m_filters (filters)
+ {}
+ };
+
+ struct Categories : public View
+ {
+ GtkWidget *m_scroll, *m_view;
+ public:
+ virtual GtkWidget *getWidget()
+ { return m_scroll; }
+
+ Categories (Filters *filters, Ypp::Package::Type type)
+ : View (filters)
+ {
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+
+ m_view = gtk_tree_view_new();
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (m_view), FALSE);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_view), 0);
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes ("",
+ renderer, "pixbuf", 2, NULL);
+ gtk_tree_view_column_set_expand (column, FALSE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (m_view), column);
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes ("",
+ renderer, "text", 0, NULL);
+ gtk_tree_view_column_set_expand (column, TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (m_view), column);
+ if (type == Ypp::Package::PATCH_TYPE)
+ gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (m_view), FALSE);
+ else
+ gtk_tree_view_set_expander_column (GTK_TREE_VIEW (m_view), column);
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (m_view));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (selection_cb), this);
+
+ m_scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (m_scroll),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_size_request (m_scroll, -1, 200);
+ gtk_container_add (GTK_CONTAINER (m_scroll), m_view);
+
+ build (type);
+ }
+
+ void build (Ypp::Package::Type type)
+ {
+ GtkTreeModel *model = NULL;
+
+ struct inner {
+ static void populate (GtkTreeStore *store, GtkTreeIter *parent,
+ Ypp::Node *category)
+ {
+ if (!category)
+ return;
+ GtkTreeIter iter;
+ gtk_tree_store_append (store, &iter, parent);
+ const std::string &name = category->name;
+ gtk_tree_store_set (store, &iter, 0, name.c_str(), 1, category, -1);
+ if (!parent) {
+ const gchar *icon = 0;
+ for (unsigned int i = 0; i < CAT_SIZE; i++)
+ if (name == catIconMap[i].category) {
+ icon = catIconMap[i].icon;
+ break;
+ }
+ if (icon) {
+ GtkIconTheme *icons = gtk_icon_theme_get_default();
+ GdkPixbuf *pixbuf;
+ pixbuf = gtk_icon_theme_load_icon (icons, icon, 22,
+ GtkIconLookupFlags (0), NULL);
+ gtk_tree_store_set (store, &iter, 2, pixbuf, -1);
+ }
+ }
+ populate (store, &iter, category->child());
+ populate (store, parent, category->next());
+ }
+ };
+
+ GtkTreeStore *store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_POINTER,
+ GDK_TYPE_PIXBUF);
+ model = GTK_TREE_MODEL (store);
+
+ GtkTreeIter iter;
+ gtk_tree_store_append (store, &iter, NULL);
+ gtk_tree_store_set (store, &iter, 0, _("All"), 1, NULL, -1);
+
+ inner::populate (store, NULL, Ypp::get()->getFirstCategory (type));
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (m_view));
+ g_signal_handlers_block_by_func (selection, (gpointer) selection_cb, this);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (m_view), model);
+ if (model) {
+ g_object_unref (G_OBJECT (model));
+
+ /* we use gtk_tree_view_set_cursor(), rather than gtk_tree_selection_select_iter()
+ because that one is buggy in that when the user first interacts with the treeview,
+ a change signal is sent, even if he was just expanding one node... */
+ GtkTreePath *path = gtk_tree_path_new_first();
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (m_view), path, NULL, FALSE);
+ gtk_tree_path_free (path);
+ }
+
+ g_signal_handlers_unblock_by_func (selection, (gpointer) selection_cb, this);
+ }
+
+ Ypp::Node *getActive()
+ {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (m_view));
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ Ypp::Node *category = 0;
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ gtk_tree_model_get (model, &iter, 1, &category, -1);
+ return category;
+ }
+
+ static void selection_cb (GtkTreeSelection *selection, View *pThis)
+ {
+ pThis->m_filters->signalChanged();
+ }
+
+ virtual void writeQuery (Ypp::Query *query)
+ {
+ Ypp::Node *node = getActive();
+ if (node)
+ query->setCategory (node);
+ }
+ };
+
+ struct Pool : public View, public PackagesView::Listener
+ {
+ PackagesView *m_view;
+ GtkWidget *m_box, *m_buttons_box;
+ public:
+ virtual GtkWidget *getWidget()
+ { return m_box; }
+
+ Pool (Filters *filters, Ypp::Package::Type type)
+ : View (filters)
+ {
+ m_view = new PackagesView();
+ Ypp::Query *query = new Ypp::Query();
+ query->setType (type);
+ m_view->setQuery (query);
+ m_view->setListener (this);
+
+ m_buttons_box = gtk_hbox_new (TRUE, 2);
+ GtkWidget *image, *button;
+ button = gtk_button_new_with_label (_("Install All"));
+ image = gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (install_cb), this);
+ gtk_box_pack_start (GTK_BOX (m_buttons_box), button, TRUE, TRUE, 0);
+ button = gtk_button_new_with_label (_("Remove All"));
+ image = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (remove_cb), this);
+ gtk_box_pack_start (GTK_BOX (m_buttons_box), button, TRUE, TRUE, 0);
+ gtk_widget_set_sensitive (m_buttons_box, FALSE);
+
+ m_box = gtk_vbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (m_box), m_view->getWidget(), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_box), m_buttons_box, FALSE, TRUE, 0);
+ }
+
+ std::list <Ypp::Package *> m_selected;
+
+ virtual void packagesSelected (const std::list <Ypp::Package *> &selection)
+ {
+ gtk_widget_set_sensitive (m_buttons_box, !selection.empty());
+ m_selected = selection;
+ m_filters->signalChanged();
+ }
+
+ virtual void writeQuery (Ypp::Query *query)
+ {
+ if (!m_selected.empty())
+ query->setCollection (m_selected.front());
+ }
+
+ void doAll (bool install /*or remove*/)
+ {
+ // we just need to mark the collections themselves
+ for (std::list <Ypp::Package *>::iterator it = m_selected.begin();
+ it != m_selected.end(); it++)
+ install ? (*it)->install(0) : (*it)->remove();
+ }
+
+ static void install_cb (GtkButton *button, Pool *pThis)
+ { pThis->doAll (true); }
+ static void remove_cb (GtkButton *button, Pool *pThis)
+ { pThis->doAll (false); }
+ };
+
+ View *m_view;
+ GtkWidget *m_bin;
+ Filters *m_filters;
+
+ public:
+ Collections (Filters *filters)
+ : m_view (NULL), m_filters (filters)
+ {
+ m_bin = gtk_event_box_new();
+ }
+
+ ~Collections()
+ {
+ delete m_view;
+ }
+
+ GtkWidget *getWidget()
+ { return m_bin; }
+
+ void setType (Ypp::Package::Type type)
+ {
+ if (m_view)
+ gtk_container_remove (GTK_CONTAINER (m_bin), m_view->getWidget());
+ delete m_view;
+
+ switch (type)
+ {
+ case Ypp::Package::PACKAGE_TYPE:
+ case Ypp::Package::PATCH_TYPE:
+ m_view = new Categories (m_filters, type);
+ break;
+ case Ypp::Package::PATTERN_TYPE:
+ case Ypp::Package::LANGUAGE_TYPE:
+ m_view = new Pool (m_filters, type);
+ break;
+ default:
+ m_view = NULL;
+ break;
+ }
+
+ if (m_view) {
+ gtk_widget_show_all (m_view->getWidget());
+ gtk_container_add (GTK_CONTAINER (m_bin), m_view->getWidget());
+ }
+ }
+
+ void writeQuery (Ypp::Query *query)
+ {
+ if (m_view)
+ m_view->writeQuery (query);
+ }
+ };
+
+ class StatusButtons
+ {
+ GtkWidget *m_box;
+ Filters *m_filters;
+ int m_selectedStatus;
+
+ public:
+ GtkWidget *getWidget()
+ { return m_box; }
+
+ StatusButtons (Filters *filters)
+ : m_filters (filters), m_selectedStatus (0)
+ {
+ m_box = gtk_hbox_new (FALSE, 6);
+ GtkWidget *homo_box = gtk_hbox_new (TRUE, 6); // same size box
+ gtk_box_pack_start (GTK_BOX (m_box), homo_box, TRUE, TRUE, 0);
+
+ GtkWidget *button;
+ GSList *group;
+ button = createButton ("Available", pkg_available_xpm, NULL);
+ group = ygtk_toggle_button_get_group (YGTK_TOGGLE_BUTTON (button));
+ gtk_box_pack_start (GTK_BOX (homo_box), button, TRUE, TRUE, 0);
+ button = createButton ("Upgrades", pkg_installed_upgradable_xpm, group);
+ gtk_box_pack_start (GTK_BOX (homo_box), button, TRUE, TRUE, 0);
+ button = createButton ("Installed", pkg_installed_xpm, group);
+ gtk_box_pack_start (GTK_BOX (homo_box), button, TRUE, TRUE, 0);
+ button = createButton ("All", 0, group);
+ gtk_box_pack_start (GTK_BOX (m_box), button, FALSE, TRUE, 0);
+ }
+
+ int getActive()
+ {
+ return m_selectedStatus;
+ }
+
+ GtkWidget *createButton (const char *label, const char **xpm, GSList *group)
+ {
+ GtkWidget *button = ygtk_toggle_button_new (group);
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
+ if (xpm)
+ gtk_box_pack_start (GTK_BOX (hbox), createImageFromXPM (xpm), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (label), TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER (button), hbox);
+ if (!group)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+ g_signal_connect (G_OBJECT (button), "toggle-changed",
+ G_CALLBACK (status_toggled_cb), this);
+ return button;
+ }
+
+ static void status_toggled_cb (GtkToggleButton *toggle, gint nb, StatusButtons *pThis)
+ {
+ pThis->m_selectedStatus = nb;
+ pThis->m_filters->signalChanged();
+ }
+ };
+
public:
struct Listener {
virtual void doQuery (Ypp::Query *query) = 0;
@@ -351,65 +796,69 @@
{ m_listener = listener; signalChanged(); }
private:
- GtkWidget *m_widget, *m_name, *m_status, *m_categories, *m_repos, *m_type,
- *m_categories_expander, *m_repos_expander;
+ Collections *m_collection;
+ StatusButtons *m_statuses;
+ GtkWidget *m_name, *m_repos, *m_type;
Listener *m_listener;
guint timeout_id;
- int repoToggled; // how many repos are toggled? if 0, it can speed up query
- int packageType;
+ int m_selectedType;
public:
- GtkWidget *getWidget()
- { return m_widget; }
+ GtkWidget *getCollectionWidget() { return m_collection->getWidget(); }
+ GtkWidget *getStatusesWidget() { return m_statuses->getWidget(); }
+ GtkWidget *getNameWidget() { return m_name; }
+ GtkWidget *getReposWidget() { return m_repos; }
+ GtkWidget *getTypeWidget() { return m_type; }
- Filters()
- : m_listener (NULL), timeout_id (0), repoToggled (0), packageType (-1)
+ Filters (bool update_mode)
+ : m_listener (NULL), timeout_id (0), m_selectedType (-1)
{
- GtkWidget *vbox = gtk_vbox_new (FALSE, 4);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- GtkSizeGroup *size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ m_collection = new Collections (this);
+ m_statuses = new StatusButtons (this);
m_name = ygtk_find_entry_new();
- g_signal_connect_after (G_OBJECT (m_name), "changed",
- G_CALLBACK (entry_changed_cb), this);
- gtk_box_pack_start (GTK_BOX (vbox),
- labelWidget (_("Name: "), m_name, size_group), FALSE, TRUE, 0);
-
- m_status = gtk_combo_box_new_text();
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("All"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("Installed"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("Upgradable"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("Available"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("Modified"));
- gtk_combo_box_set_active (GTK_COMBO_BOX (m_status), 0);
- g_signal_connect_after (G_OBJECT (m_status), "changed",
- G_CALLBACK (combo_changed_cb), this);
- gtk_box_pack_start (GTK_BOX (vbox),
- labelWidget (_("Status: "), m_status, size_group), FALSE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), buildCategories(), FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), buildRepos(), FALSE, TRUE, 0);
+ gtk_widget_set_tooltip_markup (m_name,
+ _("<b>Package search:</b> Use spaces to separate your keywords. They "
+ "will be matched against RPM <i>name</i>, <i>summary</i> and "
+ "<i>provides</i> attributes.\n(e.g.: \"yast dhcp\" will return yast's "
+ "dhcpd tool)"));
+ g_signal_connect (G_OBJECT (m_name), "changed",
+ G_CALLBACK (entry_changed_cb), this);
+
+ m_repos = gtk_combo_box_new_text();
+ gtk_widget_set_tooltip_markup (m_repos,
+ _("<b>Package repositories:</b> Limits the query to one repository.\n"
+ "Repositories may be added or managed through YaST control center."));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_repos), _("All Repositories"));
+ for (int i = 0; Ypp::get()->getRepository (i); i++) {
+ const Ypp::Repository *repo = Ypp::get()->getRepository (i);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_repos), repo->name.c_str());
+ }
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_repos), 0);
+ g_signal_connect (G_OBJECT (m_repos), "changed",
+ G_CALLBACK (combo_changed_cb), this);
m_type = gtk_combo_box_new_text();
- gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Packages"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Categories"));
gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Patterns"));
gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Languages"));
- gtk_combo_box_set_active (GTK_COMBO_BOX (m_type), 0);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Patches"));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_type), update_mode ? 3 : 0);
g_signal_connect_after (G_OBJECT (m_type), "changed",
G_CALLBACK (combo_changed_cb), this);
- gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (""), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox),
- labelWidget (_("Type: "), m_type, size_group), FALSE, TRUE, 0);
-
- m_widget = gtk_notebook_new();
- gtk_notebook_append_page (GTK_NOTEBOOK (m_widget), vbox,
- gtk_label_new (_("Filters")));
- g_object_unref (G_OBJECT (size_group));
}
~Filters()
{
- if (timeout_id) g_source_remove (timeout_id);
+ if (timeout_id)
+ g_source_remove (timeout_id);
+ }
+
+public:
+ int selectedRepo()
+ {
+ int repo = gtk_combo_box_get_active (GTK_COMBO_BOX (m_repos))-1;
+ return repo;
}
private:
@@ -422,61 +871,43 @@
{
if (!m_listener) return;
- Ypp::Package::Type type;
- switch (gtk_combo_box_get_active (GTK_COMBO_BOX (m_type)))
- {
- case 0: default: type = Ypp::Package::PACKAGE_TYPE; break;
- case 1: type = Ypp::Package::PATTERN_TYPE; break;
- case 2: type = Ypp::Package::LANGUAGE_TYPE; break;
-
+ Ypp::Package::Type type = (Ypp::Package::Type)
+ gtk_combo_box_get_active (GTK_COMBO_BOX (m_type));
+
+ // adjust interface
+ if (type != m_selectedType) {
+ m_collection->setType (type);
+ m_selectedType = type;
}
- Ypp::Query *query = new Ypp::Query (type);
+ // create query
+ Ypp::Query *query = new Ypp::Query();
+ if (type == Ypp::Package::PATCH_TYPE)
+ query->setType (Ypp::Package::PATCH_TYPE);
+ else
+ query->setType (Ypp::Package::PACKAGE_TYPE);
const char *name = gtk_entry_get_text (GTK_ENTRY (m_name));
if (*name)
query->setName (std::string (name));
- switch (gtk_combo_box_get_active (GTK_COMBO_BOX (m_status)))
- {
- case 1: query->setIsInstalled (true); break;
- case 2: query->setHasUpgrade (true); break;
- case 3: query->setIsInstalled (false); break;
- case 4: query->setIsModified (true); break;
- case 0: default: break;
-
- }
+ switch (m_statuses->getActive())
{
- GtkTreeSelection *selection = gtk_tree_view_get_selection (
- GTK_TREE_VIEW (m_categories));
- GtkTreeModel *model;
- GtkTreeIter iter;
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- Ypp::Node *category;
- gtk_tree_model_get (model, &iter, 1, &category, -1);
- if (category)
- query->setCategory (category);
- }
+ case 0: query->setIsInstalled (false); break;
+ case 1: query->setHasUpgrade (true); break;
+ case 2: query->setIsInstalled (true); break;
+ case 3: default: break;
}
- if (repoToggled) {
+ m_collection->writeQuery (query);
+
+ if (selectedRepo() >= 0) {
std::list <int> reposQuery;
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (m_repos));
- GtkTreeIter iter;
- if (gtk_tree_model_get_iter_first (model, &iter)) {
- do {
- gboolean enabled;
- gint repo;
- gtk_tree_model_get (model, &iter, 0, &enabled, 2, &repo, -1);
- if (enabled)
- reposQuery.push_back (repo);
- } while (gtk_tree_model_iter_next (model, &iter));
- }
+ reposQuery.push_back (selectedRepo());
query->setRepositories (reposQuery);
}
m_listener->doQuery (query);
- updateCategories (type);
}
void signalChangedDelay()
@@ -491,245 +922,7 @@
}
};
if (timeout_id) g_source_remove (timeout_id);
- timeout_id = g_timeout_add (500, inner::timeout_cb, this);
- }
-
- void updateCategories (Ypp::Package::Type type)
- {
- if (packageType == type)
- return;
- packageType = type;
-
- GtkTreeModel *model = NULL;
-
- if (type == Ypp::Package::PACKAGE_TYPE) {
- struct inner {
- static void populate (GtkTreeStore *store, GtkTreeIter *parent,
- Ypp::Node *category)
- {
- if (!category)
- return;
- GtkTreeIter iter;
- gtk_tree_store_append (store, &iter, parent);
- const std::string &name = category->name;
- gtk_tree_store_set (store, &iter, 0, name.c_str(), 1, category, -1);
- if (!parent) {
- const char **icon = 0;
- if (name == "Development")
- icon = cat_development_xpm;
- else if (name == "Documentation")
- icon = cat_documentation_xpm;
- else if (name == "Emulators")
- icon = cat_emulators_xpm;
- else if (name == "Games")
- icon = cat_games_xpm;
- else if (name == "Hardware")
- icon = cat_hardware_xpm;
- else if (name == "Multimedia")
- icon = cat_multimedia_xpm;
- else if (name == "Network")
- icon = cat_network_xpm;
- else if (name == "Office")
- icon = cat_office_xpm;
- else if (name == "System")
- icon = cat_system_xpm;
- else if (name == "Utilities")
- icon = cat_utilities_xpm;
- if (icon) {
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (icon);
- gtk_tree_store_set (store, &iter, 2, pixbuf, -1);
- }
- }
- populate (store, &iter, category->child());
- populate (store, parent, category->next());
- }
- };
-
- GtkTreeStore *store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_POINTER,
- GDK_TYPE_PIXBUF);
- model = GTK_TREE_MODEL (store);
-
- GtkTreeIter iter;
- gtk_tree_store_append (store, &iter, NULL);
- gtk_tree_store_set (store, &iter, 0, _("All"), 1, NULL, -1);
-
- inner::populate (store, NULL, Ypp::get()->getFirstCategory (type));
-
- }
- else if (type == Ypp::Package::PATTERN_TYPE) {
- GtkListStore *store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_POINTER,
- GDK_TYPE_PIXBUF);
- model = GTK_TREE_MODEL (store);
-
- GtkTreeIter iter;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("All"), 1, NULL, -1);
-
- for (Ypp::Node *i = Ypp::get()->getFirstCategory (type); i; i = i->next()) {
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, i->name.c_str(), 1, i, -1);
- }
- }
-
- GtkTreeSelection *selection = gtk_tree_view_get_selection (
- GTK_TREE_VIEW (m_categories));
- g_signal_handlers_block_by_func (selection,
- (gpointer) categories_selection_cb, this);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (m_categories), model);
- if (model) {
- g_object_unref (G_OBJECT (model));
- gtk_widget_show (m_categories_expander);
-
- /* we use gtk_tree_view_set_cursor(), rather than gtk_tree_selection_select_iter()
- because that one is buggy in that when the user first interacts with the treeview,
- a change signal is sent, even if he was just expanding one node... */
- GtkTreePath *path = gtk_tree_path_new_first();
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (m_categories), path, NULL, FALSE);
- gtk_tree_path_free (path);
- }
- else
- gtk_widget_hide (m_categories_expander);
-
- g_signal_handlers_unblock_by_func (selection,
- (gpointer) categories_selection_cb, this);
- }
-
- GtkWidget *buildCategories()
- {
- GtkWidget *scroll;
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
-
- m_categories = gtk_tree_view_new();
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (m_categories), FALSE);
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_categories), 0);
- renderer = gtk_cell_renderer_pixbuf_new();
- column = gtk_tree_view_column_new_with_attributes ("",
- renderer, "pixbuf", 2, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (m_categories), column);
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes ("",
- renderer, "text", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (m_categories), column);
-
- GtkTreeSelection *selection = gtk_tree_view_get_selection (
- GTK_TREE_VIEW (m_categories));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
- g_signal_connect (G_OBJECT (selection), "changed",
- G_CALLBACK (categories_selection_cb), this);
-
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_widget_set_size_request (scroll, -1, 200);
- gtk_container_add (GTK_CONTAINER (scroll), m_categories);
-
- m_categories_expander = gtk_expander_new (_("Categories"));
- gtk_container_add (GTK_CONTAINER (m_categories_expander), scroll);
- gtk_expander_set_expanded (GTK_EXPANDER (m_categories_expander), TRUE);
- return m_categories_expander;
- }
-
- GtkWidget *buildRepos()
- {
- GtkWidget *scroll;
- GtkListStore *store;
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
-
- // 0 - enabled, 1 - name, 2 - ptr
- store = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_INT);
- for (int i = 0; Ypp::get()->getRepository (i); i++) {
- const Ypp::Repository *repo = Ypp::get()->getRepository (i);
- GtkTreeIter iter;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, TRUE, 1, repo->name.c_str(), 2, i, -1);
- }
- m_repos = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (m_repos), FALSE);
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_repos), 1);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (m_repos)),
- GTK_SELECTION_NONE);
- g_object_unref (G_OBJECT (store));
- renderer = gtk_cell_renderer_toggle_new();
- column = gtk_tree_view_column_new_with_attributes ("", renderer, "active", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (m_repos), column);
- g_signal_connect (G_OBJECT (renderer), "toggled",
- G_CALLBACK (repo_toggled_cb), this);
- g_signal_connect (G_OBJECT (m_repos), "row-activated",
- G_CALLBACK (repo_clicked_cb), this);
- renderer = gtk_cell_renderer_text_new();
- g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
- column = gtk_tree_view_column_new_with_attributes ("",
- renderer, "text", 1, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (m_repos), column);
-
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_widget_set_size_request (scroll, -1, 80);
- gtk_container_add (GTK_CONTAINER (scroll), m_repos);
-
- m_repos_expander = gtk_expander_new (_("Repositories"));
- gtk_container_add (GTK_CONTAINER (m_repos_expander), scroll);
- return m_repos_expander;
- }
-
- static void categories_selection_cb (GtkTreeSelection *selection, Filters *pThis)
- {
-fprintf (stderr, "CATEGORIES SELECTED\n");
- pThis->signalChanged();
- }
-
- void toggle_repo (GtkTreePath *path)
- {
- IMPL
- GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (m_repos));
- GtkListStore *store = GTK_LIST_STORE (model);
- GtkTreeIter iter;
- gtk_tree_model_get_iter (model, &iter, path);
-
- gboolean enabled;
- gtk_tree_model_get (model, &iter, 0, &enabled, -1);
- gtk_list_store_set (store, &iter, 0, !enabled, -1);
- if (enabled) repoToggled--; else repoToggled++;
-fprintf (stderr, "repoToggled count: %d\n", repoToggled);
- signalChanged();
- }
-
- static void repo_toggled_cb (GtkCellRendererToggle *renderer,
- gchar *path_str, Filters *pThis)
- {
- IMPL
- GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
- pThis->toggle_repo (path);
- gtk_tree_path_free (path);
- }
-
- static void repo_clicked_cb (GtkTreeView *view, GtkTreePath *path,
- GtkTreeViewColumn *column, Filters *pThis)
- {
- IMPL
- pThis->toggle_repo (path);
- }
-
- // utility
- static GtkWidget *labelWidget (const char *label_str, GtkWidget *widget,
- GtkSizeGroup *group)
- {
- GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
- GtkWidget *label = gtk_label_new_with_mnemonic (label_str);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
- gtk_size_group_add_widget (group, label);
- return hbox;
+ timeout_id = g_timeout_add (250, inner::timeout_cb, this);
}
};
@@ -738,92 +931,97 @@
class PackageControl
{
-GtkWidget *m_vbox, *m_status, *m_lock_button, *m_locked_image, *m_unlocked_image,
- *m_installed_box, *m_available_box, *m_remove_button, *m_install_button,
- *m_undo_button, *m_versions_combo, *m_version_repo;
-GtkTreeModel *m_versions_model;
+GtkWidget *m_widget, *m_install_button, *m_remove_button, *m_installed_version,
+ *m_available_versions, *m_undo_button, *m_lock_button, *m_locked_image,
+ *m_unlocked_image, *m_package_image;
public:
-std::list <Ypp::Package *> m_packages;
+std::list <Ypp::Package *> m_packages; // we keep a copy to test against modified...
+Filters *m_filters; // used to filter repo versions...
GtkWidget *getWidget()
- { return m_vbox; }
+ { return m_widget; }
- PackageControl()
+ PackageControl (Filters *filters)
+ : m_filters (filters)
{
- GtkSizeGroup *size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- m_vbox = gtk_vbox_new (FALSE, 6);
- GtkWidget *hbox, *label;
+ // installed
+ m_install_button = createButton ("", GTK_STOCK_SAVE);
+ g_signal_connect (G_OBJECT (m_install_button), "clicked",
+ G_CALLBACK (install_clicked_cb), this);
+
+ m_installed_version = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (m_installed_version), 0, 0.5);
+ // available
+ m_remove_button = createButton (_("_Remove"), GTK_STOCK_DELETE);
+ g_signal_connect (G_OBJECT (m_remove_button), "clicked",
+ G_CALLBACK (remove_clicked_cb), this);
+
+ m_available_versions = gtk_combo_box_new_text();
+ g_signal_connect (G_OBJECT (m_available_versions), "changed",
+ G_CALLBACK (version_changed_cb), this);
+
+ // lock
m_lock_button = gtk_toggle_button_new();
+ gtk_widget_set_tooltip_markup (m_lock_button,
+ _("<b>Package lock:</b> prevents the package status from being modified by "
+ "the solver (that is, it won't honour dependencies or collections ties.)"));
g_signal_connect (G_OBJECT (m_lock_button), "toggled",
G_CALLBACK (locked_toggled_cb), this);
- m_undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
- g_signal_connect (G_OBJECT (m_undo_button), "clicked",
- G_CALLBACK (undo_clicked_cb), this);
-
- hbox = gtk_hbox_new (FALSE, 6);
- label = gtk_label_new (_("Status:"));
- YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_size_group_add_widget (size_group, label);
- m_status = gtk_label_new ("-");
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), m_status, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), m_undo_button, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new(0), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), m_lock_button, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_vbox), hbox, TRUE, TRUE, 0);
-
m_locked_image = createImageFromXPM (pkg_locked_xpm);
m_unlocked_image = createImageFromXPM (pkg_unlocked_xpm);
g_object_ref_sink (G_OBJECT (m_locked_image));
g_object_ref_sink (G_OBJECT (m_unlocked_image));
- m_remove_button = createButton (_("_Remove"), GTK_STOCK_DELETE);
- g_signal_connect (G_OBJECT (m_remove_button), "clicked",
- G_CALLBACK (remove_clicked_cb), this);
- m_install_button = createButton ("", GTK_STOCK_SAVE);
- g_signal_connect (G_OBJECT (m_install_button), "clicked",
- G_CALLBACK (install_clicked_cb), this);
+ m_package_image = gtk_image_new();
- m_installed_box = gtk_hbox_new (FALSE, 6);
+ m_undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
+ g_signal_connect (G_OBJECT (m_undo_button), "clicked",
+ G_CALLBACK (undo_clicked_cb), this);
+
+ // layout
+ GtkWidget *table;
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ // versions
+ gtk_table_attach (GTK_TABLE (table), m_installed_version, 1, 2, 0, 1,
+ GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), m_available_versions, 1, 2, 1, 2,
+ GTK_FILL, GTK_FILL, 0, 0);
+ // buttons
+ gtk_table_attach (GTK_TABLE (table), m_remove_button, 2, 3, 0, 1,
+ GTK_FILL, GtkAttachOptions (0), 0, 0);
+ gtk_table_attach (GTK_TABLE (table), m_install_button, 2, 3, 1, 2,
+ GTK_FILL, GtkAttachOptions (0), 0, 0);
+ // labels
+ GtkWidget *label;
label = gtk_label_new (_("Installed: "));
YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_size_group_add_widget (size_group, label);
- gtk_box_pack_start (GTK_BOX (m_installed_box), label, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_installed_box), m_remove_button, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_vbox), m_installed_box, TRUE, TRUE, 0);
-
- m_versions_model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
- m_versions_combo = gtk_combo_box_new_with_model (m_versions_model);
- g_signal_connect (G_OBJECT (m_versions_combo), "changed",
- G_CALLBACK (version_changed_cb), this);
-
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (m_versions_combo), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (m_versions_combo),
- renderer, "text", 0, NULL);
-
- m_available_box = gtk_hbox_new (FALSE, 6);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
label = gtk_label_new (_("Available: "));
YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_size_group_add_widget (size_group, label);
- gtk_box_pack_start (GTK_BOX (m_available_box), label, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_available_box), m_versions_combo, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_available_box), m_install_button, FALSE, TRUE, 0);
- label = gtk_label_new (_("(Repository:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- m_version_repo = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (m_version_repo), 0, 0.5);
- gtk_label_set_ellipsize (GTK_LABEL (m_version_repo), PANGO_ELLIPSIZE_END);
- gtk_box_pack_start (GTK_BOX (m_available_box), label, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_available_box), m_version_repo, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_vbox), m_available_box, TRUE, TRUE, 0);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
- g_object_unref (G_OBJECT (size_group));
+ GtkWidget *lock_align = gtk_alignment_new (0.5, 0.5, 0, 0);
+ gtk_container_add (GTK_CONTAINER (lock_align), m_lock_button);
+
+ GtkWidget *undo_align = gtk_alignment_new (0.5, 0.5, 0, 0);
+ gtk_container_add (GTK_CONTAINER (undo_align), m_undo_button);
+
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), undo_align, FALSE, TRUE, 12);
+ gtk_box_pack_start (GTK_BOX (hbox), lock_align, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new(""), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), m_package_image, FALSE, TRUE, 0);
+
+ m_widget = gtk_alignment_new (0, 0.5, 1, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (m_widget), 6);
+ gtk_container_add (GTK_CONTAINER (m_widget), hbox);
}
~PackageControl()
@@ -836,171 +1034,118 @@
void setPackages (const std::list <Ypp::Package *> &packages)
{
-fprintf (stderr, "packages selected (%d)\n", packages.size());
- // FIXME: we'll probably want to re-work the controls interface
- // for now, let's just handle none-one-multiple selections separatadely
m_packages = packages;
- if (packages.size() == 1) {
- Ypp::Package *package = packages.front();
- // status label
- std::string status;
- if (package->isInstalled())
- status = _("Installed ") + package->getInstalledVersion()->number;
- else
- status = _("Not installed");
- if (package->toInstall()) {
- int nb;
- const Ypp::Package::Version *version;
- package->toInstall (&nb);
- version = package->getAvailableVersion (nb);
- status += _(" (to install");
- if (version)
- status += " " + version->number;
- status += ")";
- }
- else if (package->toRemove())
- status += _(" (to remove)");
- gtk_label_set_text (GTK_LABEL (m_status), status.c_str());
- if (package->isModified())
- gtk_widget_show (m_undo_button);
- else
- gtk_widget_hide (m_undo_button);
-
- // install version
- if (package->isInstalled())
- gtk_widget_show (m_installed_box);
- else
- gtk_widget_hide (m_installed_box);
+ if (packages.empty())
+ return;
+ Ypp::Package *single_package = packages.size() == 1 ? packages.front() : NULL;
- // available versions
- gtk_widget_show (m_versions_combo);
- if (package->getAvailableVersion (0)) {
- gtk_list_store_clear (GTK_LIST_STORE (m_versions_model));
- for (int i = 0; package->getAvailableVersion (i); i++) {
- const char *version = package->getAvailableVersion (i)->number.c_str();
-fprintf (stderr, "adding version: %s\n", version);
- GtkTreeIter iter;
- gtk_list_store_append (GTK_LIST_STORE (m_versions_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (m_versions_model), &iter,
- 0, version, 1, i, -1);
- }
- gtk_combo_box_set_active (GTK_COMBO_BOX (m_versions_combo), 0);
- gtk_widget_show (m_available_box);
+ bool allInstalled = true, allNotInstalled = true, allUpgradable = true,
+ allModified = true, allLocked = true, allUnlocked = true;
+ for (std::list <Ypp::Package *>::const_iterator it = packages.begin();
+ it != packages.end(); it++) {
+ if (!(*it)->isInstalled()) {
+ allInstalled = false;
+ allUpgradable = false;
+ }
+ else {
+ allNotInstalled = false;
+ const Ypp::Package::Version *version = (*it)->getAvailableVersion(0);
+ if (!version || version->cmp <= 0)
+ allUpgradable = false;
+ }
+ if ((*it)->isModified()) {
+ // if modified, can't be locked or unlocked
+ allLocked = allUnlocked = false;
}
else
- gtk_widget_hide (m_available_box);
-
- // is locked
- gtk_widget_show (m_lock_button);
- bool locked = package->isLocked();
- g_signal_handlers_block_by_func (m_lock_button, (gpointer) locked_toggled_cb, this);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_lock_button), locked);
- g_signal_handlers_unblock_by_func (m_lock_button, (gpointer) locked_toggled_cb, this);
- gtk_button_set_image (GTK_BUTTON (m_lock_button),
- locked ? m_locked_image : m_unlocked_image);
- gtk_widget_set_sensitive (m_install_button, !locked);
- gtk_widget_set_sensitive (m_remove_button, !locked);
-
- gtk_widget_show (m_vbox);
- }
- else if (packages.size()) {
- bool allInstalled = true, allNotInstalled = true, allUpgradable = true,
- allModified = true, allLocked = true, allUnlocked = true;
- for (std::list <Ypp::Package *>::const_iterator it = packages.begin();
- it != packages.end(); it++) {
- if (!(*it)->isInstalled()) {
- allInstalled = false;
- allUpgradable = false;
- }
- else {
- allNotInstalled = false;
- const Ypp::Package::Version *version = (*it)->getAvailableVersion(0);
- if (!version || version->cmp <= 0)
- allUpgradable = false;
- }
- if (!(*it)->isModified())
- allModified = false;
- if ((*it)->isLocked())
- allUnlocked = false;
- else
- allLocked = false;
- }
-
- std::string status;
- if (allInstalled)
- status = _("Installed");
- else if (allNotInstalled)
- status = _("Not installed");
+ allModified = false;
+ if ((*it)->isLocked())
+ allUnlocked = false;
else
- status = _("--");
+ allLocked = false;
+ }
- if (allModified) {
- status += _(" (modified)");
- gtk_widget_show (m_undo_button);
- }
+ if (allInstalled) {
+ gtk_widget_show (m_remove_button);
+ if (single_package)
+ gtk_label_set_text (GTK_LABEL (m_installed_version),
+ single_package->getInstalledVersion()->number.c_str());
else
- gtk_widget_hide (m_undo_button);
- gtk_label_set_text (GTK_LABEL (m_status), status.c_str());
+ gtk_label_set_text (GTK_LABEL (m_installed_version), "(several)");
+ }
+ else {
+ gtk_widget_hide (m_remove_button);
+ gtk_label_set_text (GTK_LABEL (m_installed_version), "--");
+ }
- // install version
- if (allInstalled)
- gtk_widget_show (m_installed_box);
+ GtkTreeModel *model = gtk_combo_box_get_model (
+ GTK_COMBO_BOX (m_available_versions));
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+ gtk_widget_set_sensitive (m_available_versions, FALSE);
+ gtk_widget_show (m_install_button);
+ if (single_package) {
+ if (single_package->getAvailableVersion (0)) {
+ gtk_widget_set_sensitive (m_available_versions, TRUE);
+ gtk_widget_show (m_install_button);
+ int selectedRepo = m_filters->selectedRepo();
+ for (int i = 0; single_package->getAvailableVersion (i); i++) {
+ const Ypp::Package::Version *version = single_package->getAvailableVersion (i);
+ if (selectedRepo >= 0 && version->repo != selectedRepo)
+ continue;
+ string text = version->number + "\n";
+ text += "(" + Ypp::get()->getRepository (version->repo)->name + ")";
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_available_versions), text.c_str());
+ }
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_available_versions), 0);
+ }
else
- gtk_widget_hide (m_installed_box);
-
- // available versions
- gtk_widget_hide (m_versions_combo);
- if (allNotInstalled || allUpgradable) {
- gtk_widget_show (m_available_box);
- const char *installLabel = _("Install");
- if (allUpgradable)
- installLabel = _("Upgrade");
- gtk_button_set_label (GTK_BUTTON (m_install_button), installLabel);
+ gtk_widget_hide (m_install_button);
+ }
+ else {
+ if (allUpgradable) {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_available_versions), "(upgrades)");
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_available_versions), 0);
+ gtk_button_set_label (GTK_BUTTON (m_install_button), _("Upgrade"));
+ }
+ else if (allNotInstalled) {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_available_versions), "(several)");
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_available_versions), 0);
+ gtk_button_set_label (GTK_BUTTON (m_install_button), _("Install"));
}
else
- gtk_widget_hide (m_available_box);
+ gtk_widget_hide (m_install_button);
+ }
- // is locked
- if (allLocked || allUnlocked) {
- gtk_widget_show (m_lock_button);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_lock_button), allLocked);
- gtk_button_set_image (GTK_BUTTON (m_lock_button),
- allLocked ? m_locked_image : m_unlocked_image);
- gtk_widget_set_sensitive (m_install_button, !allLocked);
- gtk_widget_set_sensitive (m_remove_button, !allLocked);
- }
- else {
- gtk_widget_hide (m_lock_button);
- gtk_widget_set_sensitive (m_install_button, TRUE);
- gtk_widget_set_sensitive (m_remove_button, TRUE);
- }
- gtk_widget_show (m_vbox);
+ // is locked
+ if (allLocked || allUnlocked) {
+ gtk_widget_show (m_lock_button);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_lock_button), allLocked);
+ gtk_button_set_image (GTK_BUTTON (m_lock_button),
+ allLocked ? m_locked_image : m_unlocked_image);
+ gtk_widget_set_sensitive (m_install_button, !allLocked);
+ gtk_widget_set_sensitive (m_remove_button, !allLocked);
+ }
+ else {
+ gtk_widget_hide (m_lock_button);
+ gtk_widget_set_sensitive (m_install_button, TRUE);
+ gtk_widget_set_sensitive (m_remove_button, TRUE);
}
+
+ if (allModified)
+ gtk_widget_show (m_undo_button);
else
- gtk_widget_hide (m_vbox);
+ gtk_widget_hide (m_undo_button);
-#if 0
- m_package = package;
- if (package) {
- if (package->isInstalled()) {
- gtk_widget_show (m_remove_button);
- gtk_widget_hide (m_install_button);
+ gtk_image_clear (GTK_IMAGE (m_package_image));
+ if (single_package) {
+ GtkIconTheme *icons = gtk_icon_theme_get_default();
+ GdkPixbuf *pixbuf = gtk_icon_theme_load_icon (icons,
+ single_package->name().c_str(), 32, GtkIconLookupFlags (0), NULL);
+ if (pixbuf) {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (m_package_image), pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
}
- else {
- gtk_widget_show (m_install_button);
- gtk_widget_hide (m_remove_button);
- }
- if (package && package->hasUpgrade())
- gtk_widget_show (m_upgrade_button);
- else
- gtk_widget_hide (m_upgrade_button);
}
- else {
- gtk_widget_hide (m_install_button);
- gtk_widget_hide (m_remove_button);
- gtk_widget_hide (m_upgrade_button);
- }
-#endif
}
private:
@@ -1011,9 +1156,9 @@
for (std::list <Ypp::Package *>::iterator it = pThis->m_packages.begin();
it != pThis->m_packages.end(); it++) {
int version;
- if (GTK_WIDGET_VISIBLE (pThis->m_versions_combo))
+ if (GTK_WIDGET_VISIBLE (pThis->m_available_versions))
version = gtk_combo_box_get_active (GTK_COMBO_BOX (
- pThis->m_versions_combo));
+ pThis->m_available_versions));
else
version = 0; // i.e. most recent (on multi-packages)
(*it)->install (version);
@@ -1033,62 +1178,50 @@
normalCursor();
}
- static void undo_clicked_cb (GtkButton *button, PackageControl *pThis)
+ static void locked_toggled_cb (GtkToggleButton *button, PackageControl *pThis)
{
+ bool lock = gtk_toggle_button_get_active (button);
busyCursor();
Ypp::get()->startTransactions();
for (std::list <Ypp::Package *>::iterator it = pThis->m_packages.begin();
it != pThis->m_packages.end(); it++)
- (*it)->undo();
+ (*it)->lock (lock);
Ypp::get()->finishTransactions();
normalCursor();
}
- static void locked_toggled_cb (GtkToggleButton *button, PackageControl *pThis)
+ static void undo_clicked_cb (GtkButton *button, PackageControl *pThis)
{
busyCursor();
Ypp::get()->startTransactions();
for (std::list <Ypp::Package *>::iterator it = pThis->m_packages.begin();
it != pThis->m_packages.end(); it++)
- (*it)->lock (gtk_toggle_button_get_active (button));
+ (*it)->undo();
Ypp::get()->finishTransactions();
normalCursor();
}
static void version_changed_cb (GtkComboBox *combo, PackageControl *pThis)
{
- fprintf (stderr, "version changed\n");
- if (!pThis->m_packages.empty()) {
+ if (pThis->m_packages.size() == 1) {
Ypp::Package *package = pThis->m_packages.front();
- int nb;
- GtkTreeIter iter;
- if (gtk_combo_box_get_active_iter (combo, &iter)) {
- gtk_tree_model_get (pThis->m_versions_model, &iter, 1, &nb, -1);
- const Ypp::Package::Version *version;
- fprintf (stderr, "get available version %d\n", nb);
- version = package->getAvailableVersion (nb);
- g_assert (version != NULL);
-
- const Ypp::Repository *repo = Ypp::get()->getRepository (version->repo);
- if (repo) {
- std::string repo_str = repo->name + ")";
- gtk_label_set_text (GTK_LABEL (pThis->m_version_repo), repo_str.c_str());
- }
- else
- gtk_label_set_text (GTK_LABEL (pThis->m_version_repo),
- "TODO: hide this for collections)");
+ int nb = gtk_combo_box_get_active (GTK_COMBO_BOX (pThis->m_available_versions));
+ if (nb == -1) return;
- const char *installLabel = _("Install");
- if (package->isInstalled()) {
- if (version->cmp > 0)
- installLabel = _("Upgrade");
- else if (version->cmp == 0)
- installLabel = _("Re-install");
- else //if (version->cmp < 0)
- installLabel = _("Downgrade");
- }
- gtk_button_set_label (GTK_BUTTON (pThis->m_install_button), installLabel);
+ const Ypp::Package::Version *version;
+ version = package->getAvailableVersion (nb);
+ assert (version != NULL);
+
+ const char *installLabel = _("Install");
+ if (package->isInstalled()) {
+ if (version->cmp > 0)
+ installLabel = _("Upgrade");
+ else if (version->cmp == 0)
+ installLabel = _("Re-install");
+ else //if (version->cmp < 0)
+ installLabel = _("Downgrade");
}
+ gtk_button_set_label (GTK_BUTTON (pThis->m_install_button), installLabel);
}
}
@@ -1105,40 +1238,61 @@
}
};
-class PackageInfo
+class PackageDetails
{
GtkWidget *m_widget, *m_description, *m_filelist, *m_changelog, *m_authors;
+PackageControl *m_control;
public:
GtkWidget *getWidget()
{ return m_widget; }
- PackageInfo()
+ PackageDetails (Filters *filters)
{
+ m_control = new PackageControl (filters);
m_widget = gtk_notebook_new();
+ gtk_notebook_set_tab_pos (GTK_NOTEBOOK (m_widget), GTK_POS_BOTTOM);
+ addPage (_("Status"), m_control->getWidget());
addPage (_("Description"), createHtmlWidget (&m_description));
addPage (_("File List"), createHtmlWidget (&m_filelist));
addPage (_("ChangeLog"), createHtmlWidget (&m_changelog));
addPage (_("Authors"), createHtmlWidget (&m_authors));
- gtk_widget_set_size_request (m_widget, -1, 150);
ygtk_html_wrap_connect_link_clicked (m_filelist,
G_CALLBACK (path_pressed_cb), NULL);
}
- void setPackage (Ypp::Package *package)
+ void setPackages (std::list <Ypp::Package *> packages)
{
- if (package) {
- setText (m_description, package->description());
- setText (m_filelist, package->filelist());
- setText (m_changelog, package->changelog());
- setText (m_authors, package->authors());
- if (!GTK_WIDGET_VISIBLE (m_widget)) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (m_widget), 0);
- gtk_widget_show (m_widget);
+ if (packages.empty()) {
+ gtk_widget_hide (m_widget);
+ }
+ else {
+ gtk_widget_show (m_widget);
+ m_control->setPackages (packages);
+ Ypp::Package *package = packages.front();
+ if (package) {
+ setText (m_description, package->description());
+ setText (m_filelist, package->filelist());
+ setText (m_changelog, package->changelog());
+ setText (m_authors, package->authors());
+ if (!GTK_WIDGET_VISIBLE (m_widget)) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (m_widget), 0);
+ gtk_widget_show (m_widget);
+ }
}
}
- else
- gtk_widget_hide (m_widget);
+ }
+
+ void packageModified (Ypp::Package *package)
+ {
+ // GTK+ doesn't fire selection change when a selected row changes, so we need
+ // to re-load PackageControl in that occasions.
+ std::list <Ypp::Package *>::iterator it;
+ for (it = m_control->m_packages.begin(); it != m_control->m_packages.end(); it++)
+ if (*it == package)
+ break;
+ if (it != m_control->m_packages.end())
+ m_control->setPackages (m_control->m_packages);
}
private:
@@ -1173,6 +1327,7 @@
}
};
+#if 0
class DiskView : public Ypp::Disk::Listener
{
GtkWidget *m_widget;
@@ -1230,7 +1385,7 @@
m_hasWarn = true;
GtkWidget *dialog, *view;
- dialog = gtk_message_dialog_new (YGUI::ui()->currentWindow(),
+ dialog = gtk_message_dialog_new (YGDialog::currentWindow(),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK, _("Disk Almost Full !"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
@@ -1266,7 +1421,6 @@
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
-// gtk_widget_set_size_request (scroll, -1, 50);
gtk_container_add (GTK_CONTAINER (scroll), view);
gtk_widget_show_all (scroll);
return scroll;
@@ -1289,87 +1443,100 @@
return combo;
}
};
+#else
+// disabled
+struct DiskView
+{
+GtkWidget *m_empty;
+GtkWidget *getWidget() { return m_empty; }
+DiskView() { m_empty = gtk_event_box_new(); }
+};
+#endif
class PackageSelector : public Filters::Listener, public PackagesView::Listener
{
PackagesView *m_packages;
Filters *m_filters;
-PackageInfo *m_info;
-PackageControl *m_control;
+PackageDetails *m_details;
DiskView *m_disk;
GtkWidget *m_box;
-TrashWindow *m_trashWin;
+ChangesPane *m_changes;
public:
GtkWidget *getWidget()
{ return m_box; }
- PackageSelector()
+ PackageSelector (bool update_mode)
{
m_packages = new PackagesView();
+ m_filters = new Filters (update_mode);
+ m_details = new PackageDetails (m_filters);
+ m_disk = new DiskView();
+ m_changes = new ChangesPane();
m_packages->setListener (this);
+ m_filters->setListener (this);
- m_control = new PackageControl();
- m_info = new PackageInfo();
+ GtkWidget *filter_box = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (filter_box), gtk_label_new (_("Filters:")), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (filter_box), m_filters->getNameWidget(), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (filter_box), m_filters->getReposWidget(), FALSE, TRUE, 0);
+
+ GtkWidget *categories_box = gtk_vbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (categories_box), m_filters->getCollectionWidget(),
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (categories_box), m_filters->getTypeWidget(), FALSE, TRUE, 0);
+
+ GtkWidget *packages_box = gtk_hpaned_new();
+ gtk_paned_pack1 (GTK_PANED (packages_box), categories_box, TRUE, TRUE);
+ gtk_paned_pack2 (GTK_PANED (packages_box), m_packages->getWidget(), TRUE, FALSE);
+ gtk_paned_set_position (GTK_PANED (packages_box), 180);
+
+ GtkWidget *details_box = gtk_vpaned_new();
+ gtk_paned_pack1 (GTK_PANED (details_box), packages_box, TRUE, FALSE);
+ gtk_paned_pack2 (GTK_PANED (details_box), m_details->getWidget(), TRUE, FALSE);
+ gtk_paned_set_position (GTK_PANED (details_box), 30000 /* minimal size */);
GtkWidget *vbox = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (vbox), m_packages->getWidget(), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), m_control->getWidget(), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), m_info->getWidget(), FALSE, TRUE, 0);
-
- m_filters = new Filters();
- m_filters->setListener (this);
- m_disk = new DiskView();
+ gtk_box_pack_start (GTK_BOX (vbox), m_filters->getStatusesWidget(), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), filter_box, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), details_box, TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- GtkWidget *left_box = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (left_box), m_filters->getWidget(), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (left_box), m_disk->getWidget(), FALSE, TRUE, 0);
+ GtkWidget *changes_box = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (changes_box), m_changes->getWidget(), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (changes_box), m_disk->getWidget(), FALSE, TRUE, 0);
m_box = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (m_box), left_box, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (m_box), vbox, TRUE, TRUE, 0);
- gtk_widget_show_all (m_box);
-
- m_control->setPackages (std::list <Ypp::Package*> ());
- m_info->setPackage (NULL);
+ gtk_box_pack_start (GTK_BOX (m_box), changes_box, FALSE, TRUE, 0);
- m_trashWin = new TrashWindow();
+ gtk_widget_show_all (m_box);
+ m_changes->setContainer (changes_box);
+ m_details->setPackages (std::list <Ypp::Package *> ());
}
~PackageSelector()
{
delete m_packages;
- delete m_control;
- delete m_info;
+ delete m_details;
delete m_filters;
delete m_disk;
- delete m_trashWin;
+ delete m_changes;
}
virtual void doQuery (Ypp::Query *query)
{
- m_packages->query (query);
+ m_packages->setQuery (query);
}
virtual void packagesSelected (const std::list <Ypp::Package *> &packages)
{
- m_control->setPackages (packages);
- if (packages.size() == 1)
- m_info->setPackage (packages.front());
- else
- m_info->setPackage (NULL);
+ m_details->setPackages (packages);
}
void packageModified (Ypp::Package *package)
{
- // GTK+ doesn't fire selection change when a selected row changes, so we need
- // to re-load PackageControl in that occasions.
- std::list <Ypp::Package *>::iterator it;
- for (it = m_control->m_packages.begin(); it != m_control->m_packages.end(); it++)
- if (*it == package)
- break;
- if (it != m_control->m_packages.end())
- m_control->setPackages (m_control->m_packages);
+ m_details->packageModified (package);
}
};
@@ -1380,35 +1547,36 @@
PackageSelector *m_package_selector;
public:
- YGPackageSelector (const YWidgetOpt &opt, YGWidget *parent)
- : YPackageSelector (opt),
+ YGPackageSelector (YWidget *parent, long mode)
+ : YPackageSelector (NULL, mode),
YGWidget (this, parent, true, YGTK_TYPE_WIZARD, NULL)
{
setBorder (0);
- YGDialog *dialog = YGUI::ui()->currentYGDialog();
+ YGTK_WIZARD (getWidget())->child_border_width = 0;
+
+ YGDialog *dialog = YGDialog::currentDialog();
dialog->setCloseCallback (confirm_cb, this);
- GtkWindow *window = dialog->getWindow();
- gtk_window_resize (window, GTK_WIDGET (window)->allocation.width,
- MAX (580, GTK_WIDGET (window)->allocation.height));
+ GtkWindow *window = YGDialog::currentWindow();
+ gtk_window_resize (window,
+ MAX (700, GTK_WIDGET (window)->allocation.width),
+ MAX (680, GTK_WIDGET (window)->allocation.height));
YGtkWizard *wizard = YGTK_WIZARD (getWidget());
ygtk_wizard_set_header_icon (wizard, window,
- THEMEDIR "/icons/32x32/apps/yast-software.png");
+ THEMEDIR "/icons/22x22/apps/yast-software.png");
ygtk_wizard_set_header_text (wizard, window, _("Package Selector"));
- ygtk_wizard_set_help_text (wizard,
- _("TO WRITE")
- );
+ ygtk_wizard_set_help_text (wizard, "");
ygtk_wizard_set_abort_button_label (wizard, _("_Cancel"));
- ygtk_wizard_set_abort_button_id (wizard, g_strdup ("cancel"), g_free);
+ ygtk_wizard_set_abort_button_str_id (wizard, "cancel");
ygtk_wizard_set_back_button_label (wizard, "");
ygtk_wizard_set_next_button_label (wizard, _("_Accept"));
- ygtk_wizard_set_next_button_id (wizard, g_strdup ("accept"), g_free);
+ ygtk_wizard_set_next_button_str_id (wizard, "accept");
g_signal_connect (G_OBJECT (getWidget()), "action-triggered",
G_CALLBACK (wizard_action_cb), this);
- m_package_selector = new PackageSelector();
+ m_package_selector = new PackageSelector (onlineUpdateMode());
gtk_container_add (GTK_CONTAINER (wizard), m_package_selector->getWidget());
Ypp::get()->setInterface (this);
@@ -1445,7 +1613,7 @@
GtkWidget *dialog;
dialog = gtk_message_dialog_new
- (YGUI::ui()->currentWindow(),
+ (YGDialog::currentWindow(),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE, _("Changes not saved!"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
@@ -1466,7 +1634,7 @@
{
std::string title = package->name() + _(" License Agreement");
GtkWidget *dialog = gtk_dialog_new_with_buttons (title.c_str(),
- YGUI::ui()->currentWindow(), GTK_DIALOG_NO_SEPARATOR,
+ YGDialog::currentWindow(), GTK_DIALOG_NO_SEPARATOR,
_("_Reject"), GTK_RESPONSE_REJECT, _("_Accept"), GTK_RESPONSE_ACCEPT, NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
@@ -1497,7 +1665,6 @@
virtual bool resolveProblems (std::list <Ypp::Problem *> problems)
{
-fprintf (stderr, "resolving %d problems\n", problems.size());
// we can't use ordinary radio buttons, as gtk+ enforces that in a group
// one must be selected...
@@ -1536,15 +1703,6 @@
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_store_set (store, &iter, ACTIVE_TOGGLE_COL, enabled, -1);
}
-#if 0
- static void renderer_toggled_cb (GtkCellRenderer *render, gchar *path_str,
- GtkTreeModel *model)
- {
- GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
- solution_toggled (model, path);
- gtk_tree_path_free (path);
- }
-#endif
static void cursor_changed_cb (GtkTreeView *view, GtkTreeModel *model)
{
GtkTreePath *path;
@@ -1572,33 +1730,6 @@
}
}
return FALSE;
-
-
-/*
- GtkTreePath *path;
- if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (view), x, y,
- &path, NULL, NULL, NULL)) {
- GtkTreeIter iter;
- gchar *tooltip_text;
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_path_free (path);
- gtk_tree_model_get (model, &iter,
- TOOLTIP_TEXT_COL, &tooltip_text, -1);
- // some strings are just " ", so we need to check that
- // now,
- bool empty = true;
- for (int i = 0; tooltip_text[i] && empty; i++)
- if (tooltip_text[i] != ' ')
- empty = false;
- if (empty)
- gtk_tooltip_set_text (tooltip, "(no details)");
- else
- gtk_tooltip_set_text (tooltip, tooltip_text);
- g_free (tooltip_text);
- return TRUE;
- }
- return FALSE;
-*/
}
};
@@ -1629,7 +1760,7 @@
}
// interface
- GtkWidget *dialog = gtk_message_dialog_new (YGUI::ui()->currentWindow(),
+ GtkWidget *dialog = gtk_message_dialog_new (YGDialog::currentWindow(),
GtkDialogFlags (0), GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
_("There are some conflicts on the transaction that must be "
"solved manually."));
@@ -1649,8 +1780,6 @@
renderer = gtk_cell_renderer_toggle_new();
gtk_cell_renderer_toggle_set_radio (
GTK_CELL_RENDERER_TOGGLE (renderer), TRUE);
-/* g_signal_connect (G_OBJECT (renderer), "toggled",
- G_CALLBACK (inner::renderer_toggled_cb), store);*/
// we should not connect the actual toggle button, as we toggle on row press
g_signal_connect (G_OBJECT (view), "cursor-changed",
G_CALLBACK (inner::cursor_changed_cb), store);
@@ -1674,63 +1803,6 @@
gtk_container_add (GTK_CONTAINER (scroll), view);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll);
-
-#if 0
- // version that uses viewport, labels and radio buttons -- unfortunately,
- // gtk+ enforces that one radio button per group to be selected -- we don't
- // want that as the user may decide to do nothing for a certain action.
- // We also don't want to add a "Do nothing" radio, as that would imply would
- // dismiss the conflict. No, we just want to let the user try to resolve current
- // conflicts...
- struct inner {
- static void solution_toggled (GtkToggleButton *toggle, bool *apply)
- { *apply = gtk_toggle_button_get_active (toggle); }
- };
-
- GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Problem Resolver"),
- YGUI::ui()->currentWindow(), GtkDialogFlags (0),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, NULL);
-
- GtkWidget *view_port = gtk_viewport_new (NULL, NULL);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (view_port), GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), view_port,
- TRUE, TRUE, 0);
- GtkWidget *main_box = gtk_vbox_new (FALSE, 6);
- gtk_container_add (GTK_CONTAINER (view_port), main_box);
-
-fprintf (stderr, "populating main box\n");
- for (std::list <Ypp::Problem *>::iterator it = problems.begin();
- it != problems.end(); it++) {
- GtkWidget *label, *box;
-fprintf (stderr, "creating label: %s\n", (*it)->description.c_str());
- label = gtk_label_new ((*it)->description.c_str());
- YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
-fprintf (stderr, "setting tooltyp: %s\n", (*it)->details.c_str());
- if (!(*it)->details.empty())
- gtk_widget_set_tooltip_text (label, (*it)->details.c_str());
-
- GSList *group = NULL;
- box = gtk_vbox_new (FALSE, 6);
- for (int i = 0; (*it)->getSolution (i); i++) {
- Ypp::Problem::Solution *solution = (*it)->getSolution (i);
-fprintf (stderr, "creating radio: %s\n", solution->description.c_str());
- GtkWidget *radio = gtk_radio_button_new_with_label (
- group, solution->description.c_str());
-fprintf (stderr, "setting tooltip: %s\n", (*it)->details.c_str());
- if (!solution->details.empty())
- gtk_widget_set_tooltip_text (radio, solution->details.c_str());
- group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
- gtk_box_pack_start (GTK_BOX (box), radio, FALSE, TRUE, 0);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (inner::solution_toggled), &solution->apply);
- }
-
- gtk_box_pack_start (GTK_BOX (main_box), label, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (main_box), box, FALSE, TRUE, 0);
- }
-#endif
-
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 480);
gtk_widget_show_all (dialog);
@@ -1748,22 +1820,22 @@
YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createPackageSelector (YWidget *parent, YWidgetOpt &opt,
- const YCPString &floppyDevice)
+#else
+#include "YPackageSelector.h"
+class YGPackageSelector : public YPackageSelector, public YGWidget
{
-/* if (opt.youMode.value())
- return new YGPatchSelector (opt, YGWidget::get (parent));
- else*/
- return new YGPackageSelector (opt, YGWidget::get (parent));
-}
+public:
+ YGPackageSelector (YWidget *parent, long mode)
+ : YPackageSelector (NULL, mode),
+ YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
+ {
+ }
+ YGWIDGET_IMPL_COMMON
+};
+#endif
-YWidget *
-YGUI::createPkgSpecial (YWidget *parent, YWidgetOpt &opt,
- const YCPString &subwidget)
+YPackageSelector *YGWidgetFactory::createPackageSelector (YWidget *parent, long mode)
{
- // same as Qt's
- y2error ("The GTK+ UI does not support PkgSpecial subwidgets!");
- return 0;
+ return new YGPackageSelector (parent, mode);
}
Modified: trunk/gtk/src/YGProgressBar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGProgressBar.cc?rev=432…
==============================================================================
--- trunk/gtk/src/YGProgressBar.cc (original)
+++ trunk/gtk/src/YGProgressBar.cc Thu Dec 20 21:44:06 2007
@@ -11,48 +11,34 @@
class YGProgressBar : public YProgressBar, public YGLabeledWidget
{
- bool m_pulse;
public:
- YGProgressBar (const YWidgetOpt &opt, YGWidget *parent,
- const YCPString& label,
- const YCPInteger& maxprogress, const YCPInteger& progress)
- : YProgressBar (opt, label, maxprogress, progress)
+ YGProgressBar (YWidget *parent, const string &label, int maxValue)
+ : YProgressBar (NULL, label, maxValue)
+ // NOTE: its label widget is positionated at the vertical, because its label
+ // may change often and so will its size, which will look odd (we may want
+ // to make the label widget to only grow).
, YGLabeledWidget (this, parent, label, YD_VERT, true,
GTK_TYPE_PROGRESS_BAR, NULL)
- {
- m_pulse = maxprogress->value() <= 0;
- }
- // NOTE: its label widget is positionated at the vertical, because its label
- // may change often and so will its size, which will look odd (we may want
- // to make the label widget to only grow).
-
- virtual ~YGProgressBar() {}
+ {}
// YProgressBar
- virtual void setProgress (const YCPInteger& newProgress)
+ virtual void setValue (int value)
{
IMPL
- if (m_pulse)
- gtk_progress_bar_pulse (GTK_PROGRESS_BAR (getWidget()));
- else {
- float fraction = (float) newProgress->value() / maxProgress->value();
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (getWidget()), fraction);
- }
- YProgressBar::setProgress (newProgress);
+ float fraction = ((float) value) / maxValue();
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (getWidget()), fraction);
+ YProgressBar::setValue (value);
}
YGWIDGET_IMPL_COMMON
YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YProgressBar)
};
-YWidget *
-YGUI::createProgressBar (YWidget* parent, YWidgetOpt& opt,
- const YCPString& label, const YCPInteger& maxprogress,
- const YCPInteger& progress)
-{
- IMPL;
- return new YGProgressBar (opt, YGWidget::get (parent),
- label, maxprogress, progress);
+YProgressBar *YGWidgetFactory::createProgressBar (YWidget *parent, const string &label,
+ int maxValue)
+{
+ IMPL
+ return new YGProgressBar (parent, label, maxValue);
}
#include "YDownloadProgress.h"
@@ -62,10 +48,9 @@
guint timeout_id;
public:
- YGDownloadProgress (const YWidgetOpt &opt, YGWidget *parent,
- const YCPString& label, const YCPString &filename,
- int expectedSize)
- : YDownloadProgress (opt, label, filename, expectedSize)
+ YGDownloadProgress (YWidget *parent, const string &label,
+ const string &filename, YFileSize_t expectedFileSize)
+ : YDownloadProgress (NULL, label, filename, expectedFileSize)
, YGLabeledWidget (this, parent, label, YD_HORIZ, true,
GTK_TYPE_PROGRESS_BAR, NULL)
{
@@ -77,16 +62,16 @@
g_source_remove (timeout_id);
}
- virtual void setExpectedSize (int expectedSize)
+ virtual void setExpectedSize (YFileSize_t size)
{
- YDownloadProgress::setExpectedSize (expectedSize);
- timeout_cb(this); // force an update
+ YDownloadProgress::setExpectedSize (size);
+ timeout_cb (this); // force an update
}
static gboolean timeout_cb (void *pData)
{
YGDownloadProgress *pThis = (YGDownloadProgress*) pData;
- float fraction = (float) pThis->currentFileSize() / pThis->expectedSize();
+ float fraction = ((float) pThis->currentFileSize()) / pThis->expectedSize();
if (fraction > 1) fraction = 1;
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (pThis->getWidget()), fraction);
return TRUE;
@@ -96,14 +81,11 @@
YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YDownloadProgress)
};
-YWidget *
-YGUI::createDownloadProgress (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, const YCPString &filename,
- int expectedSize)
+YDownloadProgress *YGOptionalWidgetFactory::createDownloadProgress (YWidget *parent,
+ const string &label, const string &filename, YFileSize_t expectedFileSize)
{
IMPL
- return new YGDownloadProgress (opt, YGWidget::get (parent),
- label, filename, expectedSize);
+ return new YGDownloadProgress (parent, label, filename, expectedFileSize);
}
#include "ygtkratiobox.h"
@@ -112,21 +94,20 @@
class YGMultiProgressMeter : public YMultiProgressMeter, public YGWidget
{
public:
- YGMultiProgressMeter (const YWidgetOpt &opt, YGWidget *parent,
- bool horizontal, const YCPList &maxValues)
- : YMultiProgressMeter (opt, horizontal, maxValues)
+ YGMultiProgressMeter (YWidget *parent, YUIDimension dim, const vector<float> &maxValues)
+ : YMultiProgressMeter (NULL, dim, maxValues)
, YGWidget (this, parent, true,
- horizontal ? YGTK_TYPE_RATIO_HBOX : YGTK_TYPE_RATIO_VBOX, NULL)
+ horizontal() ? YGTK_TYPE_RATIO_HBOX : YGTK_TYPE_RATIO_VBOX, NULL)
{
// ygtk_ratio_box_set_homogeneous (YGTK_RATIO_BOX (getWidget()), TRUE);
ygtk_ratio_box_set_spacing (YGTK_RATIO_BOX (getWidget()), 2);
for (int s = 0; s < segments(); s++) {
GtkWidget* bar = gtk_progress_bar_new();
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (bar),
- horizontal ? GTK_PROGRESS_LEFT_TO_RIGHT : GTK_PROGRESS_BOTTOM_TO_TOP);
+ horizontal() ? GTK_PROGRESS_LEFT_TO_RIGHT : GTK_PROGRESS_BOTTOM_TO_TOP);
// Progress bars would ask for too much size with weight...
const int min_size = 5;
- if (horizontal)
+ if (horizontal())
gtk_widget_set_size_request (bar, min_size, -1);
else
gtk_widget_set_size_request (bar, -1, min_size);
@@ -134,8 +115,8 @@
getSegmentWeight (s), TRUE, TRUE, 0);
}
- ygtk_adj_size_set_max (YGTK_ADJ_SIZE (m_adj_size), horizontal ? 200 : 0,
- horizontal ? 0 : 200);
+ ygtk_adj_size_set_max (YGTK_ADJ_SIZE (m_adj_size), horizontal() ? 200 : 0,
+ horizontal() ? 0 : 200);
gtk_widget_show_all (getWidget());
}
@@ -160,7 +141,7 @@
{
if (vertical())
n = (segments() - n) - 1;
- if (currentValue (n) == -1)
+ if (currentValue (n) < 0)
return 0;
return 1.0 - (((float) currentValue (n)) / maxValue (n));
}
@@ -168,10 +149,9 @@
YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createMultiProgressMeter (YWidget *parent, YWidgetOpt &opt,
- bool horizontal, const YCPList &maxValues)
+YMultiProgressMeter *YGOptionalWidgetFactory::createMultiProgressMeter (YWidget *parent,
+ YUIDimension dim, const vector<float> &maxValues)
{
- return new YGMultiProgressMeter (opt, YGWidget::get (parent),
- horizontal, maxValues);
+ return new YGMultiProgressMeter (parent, dim, maxValues);
}
+
Modified: trunk/gtk/src/YGPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=4321…
==============================================================================
--- trunk/gtk/src/YGPushButton.cc (original)
+++ trunk/gtk/src/YGPushButton.cc Thu Dec 20 21:44:06 2007
@@ -11,67 +11,86 @@
class YGPushButton : public YPushButton, public YGWidget
{
+GtkWidget *m_image;
+
public:
- YGPushButton (const YWidgetOpt &opt, YGWidget *parent, YCPString label)
- : YPushButton (opt, label),
+ YGPushButton (YWidget *parent, const string &label)
+ : YPushButton (NULL, label),
YGWidget (this, parent, true, GTK_TYPE_BUTTON, "can-default", TRUE, NULL)
{
IMPL
- if (!opt.isShrinkable.value())
- setMinSizeInChars (10, 0);
-
+ m_image = NULL;
+ setMinSizeInChars (10, 0);
gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
setLabel (label);
-
g_signal_connect (G_OBJECT (getWidget ()), "clicked",
G_CALLBACK (clicked_cb), this);
- if (opt.isDefaultButton.value())
- g_signal_connect (G_OBJECT (getWidget ()), "realize",
- G_CALLBACK (set_default_cb), this);
}
// YPushButton
- virtual void setLabel (const YCPString &label)
+ virtual void setLabel (const string &label)
{
IMPL
- string str = YGUtils::mapKBAccel (label->value_cstr());
+ string str = YGUtils::mapKBAccel (label);
gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
YGUtils::setStockIcon (getWidget(), str);
YPushButton::setLabel (label);
}
- virtual void setIcon (const YCPString &icon_name)
+ virtual void setIcon (const string &icon)
{
IMPL
- string path = icon_name->value();
- if (path[0] != '/')
- path = ICON_DIR + path;
-
- GError *error = 0;
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (path.c_str(), &error);
- if (pixbuf) {
- GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
- gtk_button_set_image (GTK_BUTTON (getWidget()), image);
- g_object_unref (G_OBJECT (pixbuf));
+ if (icon.empty())
+ // no need to worry about freeing m_image, let it live with button
+ gtk_widget_hide (m_image);
+ else {
+ string path (icon);
+ if (path[0] != '/')
+ path = ICON_DIR + path;
+
+ GError *error = 0;
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (path.c_str(), &error);
+ if (pixbuf) {
+ m_image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_button_set_image (GTK_BUTTON (getWidget()), m_image);
+ g_object_unref (G_OBJECT (pixbuf));
+ }
+ else
+ y2warning ("YGPushButton: Couldn't load icon image: %s.\n"
+ "Reason: %s", path.c_str(), error->message);
}
- else
- y2warning ("YGPushButton: Couldn't load icon image: %s.\n"
- "Reason: %s", path.c_str(), error->message);
}
- static void set_default_cb (GtkButton *button, YGPushButton *pThis)
- { gtk_widget_grab_default (GTK_WIDGET (button)); }
+ virtual void setDefaultButton (bool isDefault)
+ {
+ if (isDefault) {
+ GtkWidget *button = getWidget();
+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default (button);
+ if (GTK_WIDGET_REALIZED (button))
+ gtk_widget_grab_focus (button);
+ else
+ g_signal_connect (G_OBJECT (button), "realize",
+ G_CALLBACK (realize_cb), this);
+ }
+ YPushButton::setDefaultButton (isDefault);
+ }
+ // Events
static void clicked_cb (GtkButton *button, YGPushButton *pThis)
{ pThis->emitEvent (YEvent::Activated, false); }
+ // give focus to default buttons, once they are realized
+ static void realize_cb (GtkWidget *widget)
+ {
+ gtk_widget_grab_focus (widget);
+ }
+
YGWIDGET_IMPL_COMMON
};
-YWidget *
-YGUI::createPushButton (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label)
+YPushButton *YGWidgetFactory::createPushButton (YWidget *parent, const string &label)
{
- return new YGPushButton (opt, YGWidget::get (parent), label);
+ return new YGPushButton (parent, label);
}
Modified: trunk/gtk/src/YGRadioButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGRadioButton.cc?rev=432…
==============================================================================
--- trunk/gtk/src/YGRadioButton.cc (original)
+++ trunk/gtk/src/YGRadioButton.cc Thu Dec 20 21:44:06 2007
@@ -4,8 +4,7 @@
#include <config.h>
#include <ycp/y2log.h>
-#include <YGUI.h>
-#include "YEvent.h"
+#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
@@ -38,23 +37,15 @@
class YGRadioButton : public YRadioButton, public YGWidget
{
- bool m_isBold;
-
public:
-
- YGRadioButton (const YWidgetOpt &opt,
- YGWidget *parent,
- YCPString label,
- YRadioButtonGroup *rbg,
- bool checked)
- : YRadioButton (opt, label, rbg),
+ YGRadioButton (YWidget *parent, const std::string &label, bool isChecked)
+ : YRadioButton (NULL, label),
YGWidget (this, parent, true, getCheckRadioButtonType(), NULL)
{
IMPL
setBorder (0);
- setValue (YCPBoolean (checked));
+ setValue (isChecked);
- m_isBold = opt.boldFont.value();
gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
setLabel (label);
@@ -63,67 +54,64 @@
}
// YRadioButton
- virtual void setLabel (const YCPString &text)
+ virtual void setLabel (const string &text)
{
// NOTE: we can't just set a gtk_widget_modify() at the initialization
// because each gtk_button_set_label() creates a new label
IMPL
- string str = YGUtils::mapKBAccel(text->value_cstr());
- if (m_isBold)
- str = "<b>" + str + "</b>";
+ string str = YGUtils::mapKBAccel(text.c_str());
gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
YRadioButton::setLabel (text);
+ }
- GtkWidget *label = gtk_bin_get_child (GTK_BIN (getWidget()));
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ virtual bool value()
+ {
+ IMPL
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (getWidget()));
}
- virtual void setValue (const YCPBoolean &checked)
+ virtual void setValue (bool checked)
{
IMPL
+ fprintf (stderr, "setValue: %d to %s\n", checked, getDebugLabel().c_str());
g_signal_handlers_block_by_func (getWidget(), (gpointer) toggled_cb, this);
- if (checked->value())
- buttonGroup()->uncheckOtherButtons (this);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()),
- checked->value());
+ if (checked)
+ buttonGroup()->uncheckOtherButtons ((YRadioButton *) this);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()), checked);
g_signal_handlers_unblock_by_func (getWidget(), (gpointer) toggled_cb, this);
}
- virtual YCPBoolean getValue()
- {
- IMPL
- return YCPBoolean (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (getWidget())));
- }
-
- // YWidget
YGWIDGET_IMPL_COMMON
+ YGWIDGET_IMPL_USE_BOLD (YRadioButton)
// callbacks
static void toggled_cb (GtkButton *button, YGRadioButton *pThis)
{
IMPL
+fprintf(stderr, "toggled\n");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
- pThis->buttonGroup()->uncheckOtherButtons (pThis);
+{
+fprintf(stderr, "uncheck others\n");
+ pThis->buttonGroup()->uncheckOtherButtons ((YRadioButton *) pThis);
+// pThis->emitEvent (YEvent::ValueChanged);
+}
else {
+ // leave it active
g_signal_handlers_block_by_func (button, (gpointer) toggled_cb, pThis);
+fprintf(stderr, "set active\n");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_handlers_unblock_by_func (button, (gpointer) toggled_cb, pThis);
}
-
- pThis->emitEvent (YEvent::ValueChanged);
}
};
-YWidget *
-YGUI::createRadioButton (YWidget *parent, YWidgetOpt &opt,
- YRadioButtonGroup *rbg, const YCPString &label,
- bool checked)
+YRadioButton *YGWidgetFactory::createRadioButton (YWidget *parent, const string &label,
+ bool isChecked)
{
- IMPL;
- return new YGRadioButton (opt, YGWidget::get (parent), label, rbg, checked);
+ IMPL
+ return new YGRadioButton (parent, label, isChecked);
}
// YRadioButtonGroup
@@ -131,22 +119,19 @@
class YGRadioButtonGroup : public YRadioButtonGroup, public YGWidget
{
public:
- YGRadioButtonGroup(const YWidgetOpt &opt,
- YGWidget *parent)
- : YRadioButtonGroup (opt),
+ YGRadioButtonGroup(YWidget *parent)
+ : YRadioButtonGroup (NULL),
YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
- { }
+ {}
YGWIDGET_IMPL_COMMON
YGWIDGET_IMPL_CHILD_ADDED (m_widget)
YGWIDGET_IMPL_CHILD_REMOVED (m_widget)
};
-YContainerWidget *
-YGUI::createRadioButtonGroup (YWidget *parent, YWidgetOpt &opt)
+YRadioButtonGroup *YGWidgetFactory::createRadioButtonGroup (YWidget *parent)
{
- IMPL;
- return new YGRadioButtonGroup (opt, YGWidget::get (parent));
+ return new YGRadioButtonGroup (parent);
}
#include "YCheckBox.h"
@@ -156,88 +141,81 @@
bool m_isBold;
public:
- YGCheckBox(const YWidgetOpt &opt,
- YGWidget *parent,
- const YCPString &label_str,
- bool checked)
- : YCheckBox (opt, label_str),
+ YGCheckBox(YWidget *parent, const string &label, bool isChecked)
+ : YCheckBox (NULL, label),
YGWidget (this, parent, true, GTK_TYPE_CHECK_BUTTON, NULL)
{
IMPL
setBorder (0);
- m_isBold = opt.boldFont.value();
gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
- setLabel (label_str);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()), checked);
+ setLabel (label);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()), isChecked);
g_signal_connect (G_OBJECT (getWidget ()), "toggled",
G_CALLBACK (toggled_cb), this);
}
// YCheckButton
- virtual void setLabel (const YCPString &text)
+ virtual void setLabel (const string &text)
{
IMPL
- string str = YGUtils::mapKBAccel(text->value_cstr());
- if (m_isBold)
- str = "<b>" + str + "</b>";
+ string str = YGUtils::mapKBAccel(text);
gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
YCheckBox::setLabel (text);
+ }
- GtkWidget *label = gtk_bin_get_child (GTK_BIN (getWidget()));
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ virtual YCheckBoxState value()
+ {
+ IMPL
+ GtkToggleButton *button = GTK_TOGGLE_BUTTON (getWidget());
+
+ if (gtk_toggle_button_get_inconsistent (button))
+ return YCheckBox_dont_care;
+ return gtk_toggle_button_get_active (button) ? YCheckBox_on : YCheckBox_off;
}
- virtual void setValue (const YCPValue &val)
+ virtual void setValue (YCheckBoxState value)
{
- IMPL;
+ IMPL
GtkToggleButton *button = GTK_TOGGLE_BUTTON (getWidget());
g_signal_handlers_block_by_func (getWidget(), (gpointer) toggled_cb, this);
- if (val->isBoolean()) {
- gtk_toggle_button_set_inconsistent (button, FALSE);
- gtk_toggle_button_set_active (button, val->asBoolean()->value());
+ switch (value) {
+ case YCheckBox_dont_care:
+ gtk_toggle_button_set_inconsistent (button, TRUE);
+ break;
+ case YCheckBox_on:
+ gtk_toggle_button_set_inconsistent (button, FALSE);
+ gtk_toggle_button_set_active (button, TRUE);
+ break;
+ case YCheckBox_off:
+ gtk_toggle_button_set_inconsistent (button, FALSE);
+ gtk_toggle_button_set_active (button, FALSE);
+ break;
}
- else
- gtk_toggle_button_set_inconsistent (button, TRUE);
g_signal_handlers_unblock_by_func (getWidget(), (gpointer) toggled_cb, this);
}
- virtual YCPValue getValue()
- {
- IMPL;
-
- GtkToggleButton *button = GTK_TOGGLE_BUTTON (getWidget());
-
- if (gtk_toggle_button_get_inconsistent (button))
- return YCPVoid();
- else
- return YCPBoolean (gtk_toggle_button_get_active (button));
- }
-
static void toggled_cb (GtkBox *box, YGCheckBox *pThis)
{
IMPL
GtkToggleButton *button = GTK_TOGGLE_BUTTON (box);
- if (gtk_toggle_button_get_inconsistent (button)) {
- gtk_toggle_button_set_inconsistent (button, false);
- pThis->setValue (YCPBoolean (true));
- }
-
+ if (gtk_toggle_button_get_inconsistent (button))
+ pThis->setValue (YCheckBox_on);
pThis->emitEvent (YEvent::ValueChanged);
}
YGWIDGET_IMPL_COMMON
+ YGWIDGET_IMPL_USE_BOLD (YCheckBox)
};
-YWidget *
-YGUI::createCheckBox (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label,
- bool checked)
+YCheckBox *YGWidgetFactory::createCheckBox (YWidget *parent, const string &label,
+ bool isChecked)
{
- IMPL;
- return new YGCheckBox (opt, YGWidget::get (parent), label, checked);
+ IMPL
+ return new YGCheckBox (parent, label, isChecked);
}
+
Modified: trunk/gtk/src/YGTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=43216&r1=…
==============================================================================
--- trunk/gtk/src/YGTable.cc (original)
+++ trunk/gtk/src/YGTable.cc Thu Dec 20 21:44:06 2007
@@ -7,220 +7,138 @@
#include <YGUI.h>
#include "YGUtils.h"
#include "YGWidget.h"
+#include "YSelectionWidget.h"
+#include "YGSelectionModel.h"
+#include "ygtkcellrenderertextpixbuf.h"
/* A generic widget for table related widgets. */
-class YGTableView : public YGScrolledWidget
+class YGTableView : public YGScrolledWidget, public YGSelectionModel
{
protected:
int m_colsNb;
public:
- YGTableView (YWidget *y_widget, YGWidget *parent,
- const YWidgetOpt &opt, YCPString label)
- : YGScrolledWidget (y_widget, parent, label, YD_VERT, true,
+ YGTableView (YWidget *ywidget, YWidget *parent, const string &label,
+ bool ordinaryModel, bool isTree)
+ : YGScrolledWidget (ywidget, parent, label, YD_VERT, true,
GTK_TYPE_TREE_VIEW, NULL)
+ , YGSelectionModel ((YSelectionWidget *) ywidget, ordinaryModel, isTree)
{
IMPL
- m_colsNb = 0;
+ if (ordinaryModel) {
+ addColumn (GDK_TYPE_PIXBUF, "", YAlignUnchanged, YGSelectionModel::ICON_COLUMN);
+ addColumn (G_TYPE_STRING, "", YAlignUnchanged, YGSelectionModel::LABEL_COLUMN);
+ gtk_tree_view_set_model (getView(), getModel());
+ }
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (getWidget()), FALSE);
/* Yast tools expect the user to be unable to un-select the row. They
generally don't check to see if the returned value is -1. So, just
disallow un-selection. */
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
- GTK_TREE_VIEW (getWidget())), GTK_SELECTION_BROWSE);
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (getView());
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
// let the derivates do the event hooks. They have subtile differences.
}
- void initModel (const vector <GType> &types, bool show_headers)
- {
- IMPL
- // turn vector into an array; last column dedicated to the row id
- m_colsNb = types.size();
- GType types_array [m_colsNb+1];
- for (unsigned int i = 0; i < types.size(); i++)
- types_array [i] = types[i];
- types_array[m_colsNb] = G_TYPE_INT;
+ inline GtkTreeView *getView()
+ { return GTK_TREE_VIEW (getWidget()); }
- GtkListStore *list = gtk_list_store_newv (m_colsNb+1, types_array);
- gtk_tree_view_set_model (GTK_TREE_VIEW (getWidget()), GTK_TREE_MODEL (list));
- g_object_unref (G_OBJECT (list));
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (getWidget()), show_headers);
- }
-
- void insertColumn (int col_nb, string header, GType type)
+ void addColumn (GType type, string header, YAlignmentType header_align, int col_nb)
{
IMPL
GtkTreeViewColumn *column = 0;
// The allignment of the column items
- gfloat xalign = 0.0;
- if (header.length()) {
- if (header[0] == 'R')
- xalign = 1.0;
- else if (header[0] == 'C')
+ gfloat xalign = -1;
+ switch (header_align) {
+ case YAlignBegin:
+ xalign = 0.0;
+ break;
+ case YAlignCenter:
xalign = 0.5;
- // else if (header[0] == 'L')
- header = header.substr(1);
- }
+ break;
+ case YAlignEnd:
+ xalign = 1.0;
+ break;
+ case YAlignUnchanged:
+ break;
+ }
+ GtkCellRenderer *renderer = 0;
if (type == G_TYPE_STRING) {
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
- g_object_set (renderer, "xalign", xalign, NULL);
- // set the last column, the expandable one, as wrapable
- if (col_nb == m_colsNb-1 && col_nb >= 3)
- g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes (header.c_str(),
renderer, "text", col_nb, NULL);
}
+ else if (type == GDK_TYPE_PIXBUF) {
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes (header.c_str(),
+ renderer, "pixbuf", col_nb, NULL);
+ }
else if (type == G_TYPE_BOOLEAN) { // toggle button
- GtkCellRenderer *renderer = gtk_cell_renderer_toggle_new();
+ renderer = gtk_cell_renderer_toggle_new();
g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (col_nb));
- g_object_set (renderer, "xalign", xalign, NULL);
column = gtk_tree_view_column_new_with_attributes (header.c_str(),
renderer, "active", col_nb, NULL);
g_signal_connect (G_OBJECT (renderer), "toggled",
G_CALLBACK (toggled_cb), this);
}
- else if (type == GDK_TYPE_PIXBUF) {
- GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
- g_object_set (renderer, "xalign", xalign, NULL);
+ else if (type == YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF) { // string, pixbuf combo
+ renderer = ygtk_cell_renderer_text_pixbuf_new();
+ g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (col_nb));
column = gtk_tree_view_column_new_with_attributes (header.c_str(),
- renderer, "pixbuf", col_nb, NULL);
+ renderer, "pixbuf", col_nb, "text", col_nb+1, NULL);
}
else
g_error ("YGTable: no support for column of given type");
- gtk_tree_view_column_set_resizable (column, TRUE);
- gtk_tree_view_insert_column (GTK_TREE_VIEW (getWidget()), column, col_nb);
- }
-
- void setSearchCol (int col)
- {
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (getWidget()), col);
- }
-
-protected:
- inline GtkListStore *getStore()
- { return GTK_LIST_STORE (getModel()); }
- inline GtkTreeModel *getModel()
- { return gtk_tree_view_get_model (GTK_TREE_VIEW (getWidget())); }
-
-protected:
- /* NOTE: gtk_list_store_insert() doesn't necessarly put the row in the
- requested position. For instance, if the number of rows is smaller than
- the one requested, it just appends it. So, we must translate YCP rows
- numbering to the ones we set. We'll call YCP rows as ids.
- Besides, if we do sorting, paths will get changed. */
-
- bool getRowOf (GtkTreeIter *iter, int id) {
- if (!gtk_tree_model_get_iter_first (getModel(), iter))
- return false;
-
- int _id = -1;
- do {
- gtk_tree_model_get (getModel(), iter, m_colsNb, &_id, -1);
- if (_id == id)
- return true;
- } while (gtk_tree_model_iter_next (getModel(), iter));
- return false;
- }
-
- int getIdOf (int row) {
- GtkTreeIter iter;
- if (!gtk_tree_model_iter_nth_child (getModel(), &iter, NULL, row))
- return -1;
-
- int id;
- gtk_tree_model_get (getModel(), &iter, m_colsNb, &id, -1);
- return id;
- }
+ if (renderer && xalign != -1)
+ g_object_set (renderer, "xalign", xalign, NULL);
- void addRow (int id)
- {
- IMPL
- GtkTreeIter iter;
- gtk_list_store_append (getStore(), &iter);
- gtk_list_store_set (getStore(), &iter, m_colsNb, id, -1);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_append_column (getView(), column);
}
- void setItemText (string text, int id, int col)
- {
- IMPL
- GtkTreeIter iter;
- if (getRowOf (&iter, id))
- gtk_list_store_set (getStore(), &iter, col, text.c_str(), -1);
- }
+ virtual void setModel (GtkTreeModel *model)
+ { gtk_tree_view_set_model (GTK_TREE_VIEW (getWidget()), model); }
- void setItemBool (gboolean state, int id, int col)
+ // YGSelectionModel
+ virtual void setFocusItem (GtkTreeIter *iter, bool addingRow)
{
- IMPL
- GtkTreeIter iter;
- if (getRowOf (&iter, id))
- gtk_list_store_set (getStore(), &iter, col, state, -1);
- }
+ blockEvents();
+ GtkTreePath *path = gtk_tree_model_get_path (getModel(), iter);
- void setItemIcon (string icon, int id, int col)
- {
- IMPL
- GtkTreeIter iter;
- if (getRowOf (&iter, id)) {
- GdkPixbuf *pixbuf;
- if (icon[0] != '/')
- icon = ICON_DIR + icon;
-
- GError *error = 0;
- pixbuf = gdk_pixbuf_new_from_file (icon.c_str(), &error);
- if (!pixbuf)
- y2warning ("YGTable: Could not load icon: %s.\n"
- "Because %s", icon.c_str(), error->message);
+ gtk_tree_view_expand_to_path (getView(), path);
- gtk_list_store_set (getStore(), &iter, col, pixbuf, -1);
- }
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (getView());
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_view_set_cursor (getView(), path, NULL, FALSE);
+ gtk_tree_view_scroll_to_cell (getView(), path, NULL, TRUE, 0.5, 0.5);
+ gtk_tree_path_free (path);
+ gtk_widget_grab_focus (getWidget());
+ unblockEvents();
}
- void deleteRows()
+ virtual void unsetFocus()
{
- IMPL
blockEvents();
- gtk_list_store_clear (getStore());
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (getView());
+ gtk_tree_selection_unselect_all (selection);
unblockEvents();
}
- int getCurrentRow()
+ virtual YItem *focusItem()
{
- IMPL
- GtkTreePath *path;
- gtk_tree_view_get_cursor (GTK_TREE_VIEW(getWidget()), &path, NULL);
- if (path == NULL)
- return -1;
-
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (getView());
GtkTreeIter iter;
- gtk_tree_model_get_iter (getModel(), &iter, path);
- gtk_tree_path_free (path);
-
- int id;
- gtk_tree_model_get (getModel(), &iter, m_colsNb, &id, -1);
- return id;
- }
-
- void setCurrentRow (int id)
- {
- IMPL
- blockEvents();
- GtkTreeIter iter;
- if (getRowOf (&iter, id)) {
- GtkTreePath *path = gtk_tree_model_get_path (getModel(), &iter);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (getWidget()), path, NULL, false);
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (getWidget()), path, NULL,
- TRUE, 0.5, 0.5);
- gtk_tree_path_free (path);
- }
- unblockEvents();
+ if (gtk_tree_selection_get_selected (selection, NULL, &iter))
+ return getItem (&iter);
+ return NULL;
}
+protected:
void blockEvents()
{
g_signal_handlers_block_by_func (getWidget(), (gpointer) selected_cb, this);
@@ -239,18 +157,20 @@
GtkTreeIter iter;
if (!gtk_tree_model_get_iter (getModel(), &iter, path))
return;
- gboolean state;
+ gboolean state;
gtk_tree_model_get (getModel(), &iter, column, &state, -1);
- gtk_list_store_set (getStore(), &iter, column, !state, -1);
+ state = !state;
+ gtk_list_store_set (GTK_LIST_STORE (getModel()), &iter, column, state, -1);
+ ((YSelectionWidget *) m_ywidget)->selectItem (getItem (&iter), state);
emitEvent (YEvent::ValueChanged);
}
static void selected_cb (GtkTreeView *tree_view, YGTableView* pThis)
{
IMPL
- pThis->emitEvent (YEvent::SelectionChanged);
+ pThis->emitEvent (YEvent::SelectionChanged, true, true);
}
static void selected_delayed_cb (GtkTreeView *tree_view, YGTableView* pThis)
@@ -282,64 +202,90 @@
class YGTable : public YTable, public YGTableView
{
public:
- YGTable (const YWidgetOpt &opt, YGWidget *parent,
- vector <string> headers)
- : YTable (opt, headers.size()),
- YGTableView (this, parent, opt, YCPString(""))
+ YGTable (YWidget *parent, YTableHeader *_header)
+ : YTable (NULL, _header)
+ , YGTableView (this, parent, string(), false, false)
{
IMPL
+ gtk_tree_view_set_headers_visible (getView(), TRUE);
+ gtk_tree_view_set_rules_hint (getView(), columns() > 1);
+
vector <GType> types;
- types.assign (numCols(), G_TYPE_STRING);
- initModel (types, true);
- for (int i = 0; i < numCols(); i++)
- insertColumn (i, headers[i], types[i]);
-
- setLabelVisible (false);
-
- if (!opt.keepSorting.value())
- YGUtils::tree_view_set_sortable (GTK_TREE_VIEW (getWidget()), 0);
- if (numCols() >= 3)
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (getWidget()), TRUE);
+ for (int i = 0; i < columns(); i++) {
+ types.push_back (GDK_TYPE_PIXBUF);
+ types.push_back (G_TYPE_STRING);
+ }
+ createModel (types);
+ for (int i = 0; i < columns(); i++)
+ addColumn (YGTK_TYPE_CELL_RENDERER_TEXT_PIXBUF,
+ header (i), alignment (i), i*2);
+ gtk_tree_view_set_model (getView(), getModel());
g_signal_connect (G_OBJECT (getWidget()), "row-activated",
G_CALLBACK (activated_cb), (YGTableView*) this);
- if (opt.immediateMode.value())
+ if (immediateMode())
g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
G_CALLBACK (selected_cb), (YGTableView*) this);
+ setSortable (true);
}
- virtual void itemAdded (vector<string> elements, int index)
+ virtual void setKeepSorting (bool keepSorting)
{
- IMPL
- addRow (index);
- for (unsigned int c = 0; c < elements.size(); c++)
- setItemText (elements[c], index, c);
-
- // always have one row selected
- if (getCurrentRow() == -1)
- setCurrentRow (index);
+ setSortable (keepSorting);
+ YTable::setKeepSorting (keepSorting);
}
- virtual void itemsCleared()
- { IMPL; deleteRows(); }
+ virtual void addItem (YItem *_item)
+ {
+ YTableItem *item = dynamic_cast <YTableItem *> (_item);
+ if (item) {
+ GtkTreeIter iter;
+ addRow (&iter, _item);
+ for (int i = 0; i < columns(); i++)
+ setCell (&iter, item->cell (i));
+ }
+ else
+ y2error ("Can only add YTableItems to a YTable.");
+ YTable::addItem (_item);
+ }
- virtual void cellChanged (int index, int colnum, const YCPString& text)
- { IMPL; setItemText (text->value(), index, colnum); }
+ virtual void cellChanged (const YTableCell *cell)
+ {
+ GtkTreeIter iter;
+ if (getIter (cell->parent(), &iter))
+ setCell (&iter, cell);
+ }
- virtual int getCurrentItem()
- { IMPL; return getCurrentRow(); }
+ void setCell (GtkTreeIter *iter, const YTableCell *cell)
+ {
+ int index = cell->column() * 2;
+ setCellIcon (iter, index, cell->iconName());
+ setCellLabel (iter, index+1, cell->label());
+ }
- virtual void setCurrentItem (int index)
- { IMPL; setCurrentRow (index); }
+ void setSortable (bool sortable)
+ {
+ IMPL
+ int n = 0;
+ GList *columns = gtk_tree_view_get_columns (getView());
+ for (GList *i = columns; i; i = i->next, n++) {
+ GtkTreeViewColumn *column = (GtkTreeViewColumn *) i->data;
+ int index = (n*2)+1;
+ if (!sortable)
+ index = -1;
+ gtk_tree_view_column_set_sort_column_id (column, index);
+ }
+ g_list_free (columns);
+ }
YGWIDGET_IMPL_COMMON
+ YGSELECTION_WIDGET_IMPL_CLEAR (YTable)
+ YGSELECTION_WIDGET_IMPL_SELECT (YTable)
};
-YWidget *
-YGUI::createTable (YWidget *parent, YWidgetOpt & opt,
- vector<string> headers)
+YTable *YGWidgetFactory::createTable (YWidget *parent, YTableHeader *header)
{
- return new YGTable (opt, YGWidget::get (parent), headers);
+ return new YGTable (parent, header);
}
#include "YSelectionBox.h"
@@ -347,67 +293,28 @@
class YGSelectionBox : public YSelectionBox, public YGTableView
{
public:
- YGSelectionBox (const YWidgetOpt &opt, YGWidget *parent,
- const YCPString &label)
- : YSelectionBox (opt, label),
- YGTableView (this, parent, opt, label)
+ YGSelectionBox (YWidget *parent, const string &label)
+ : YSelectionBox (NULL, label),
+ YGTableView (this, parent, label, true, false)
{
- /* we'll have to wait for 09 to get nicer to construct vectors :P */
- vector <GType> types;
- types.push_back (GDK_TYPE_PIXBUF);
- types.push_back (G_TYPE_STRING);
- initModel (types, false);
-
- insertColumn (1, "", G_TYPE_STRING);
- setSearchCol (1);
- // pixbuf column will be added later, if needed
-
g_signal_connect (G_OBJECT (getWidget()), "row-activated",
G_CALLBACK (activated_cb), (YGTableView*) this);
- if (opt.immediateMode.value())
+ if (immediateMode())
g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
G_CALLBACK (selected_cb), (YGTableView*) this);
else
g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
- G_CALLBACK (selected_delayed_cb), (YGTableView*) this);
+ G_CALLBACK (selected_delayed_cb), (YGTableView*) this);
}
- // YSelectionBox
- virtual int getCurrentItem()
- { IMPL; return getCurrentRow(); }
-
- virtual void setCurrentItem (int index)
- { IMPL; setCurrentRow (index); }
-
- // YSelectionWidget
- virtual void itemAdded (const YCPString &str, int index, bool selected)
- {
- IMPL
- addRow (index);
-
- if (hasIcons()) {
- if (m_colsNb == 1) // make space for pixbufs
- insertColumn (0, "", GDK_TYPE_PIXBUF);
- setItemIcon (itemIcon (index)->value(), index, 0);
- }
- setItemText (str->value(), index, 1);
-
- if (selected)
- setCurrentRow (index);
- }
-
- virtual void deleteAllItems()
- { IMPL; deleteRows(); }
-
YGWIDGET_IMPL_COMMON
+ YGSELECTION_WIDGET_IMPL_ALL (YSelectionBox)
};
-YWidget *
-YGUI::createSelectionBox (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label)
+YSelectionBox *YGWidgetFactory::createSelectionBox (YWidget *parent, const string &label)
{
IMPL
- return new YGSelectionBox (opt, YGWidget::get (parent), label);
+ return new YGSelectionBox (parent, label);
}
#include "YMultiSelectionBox.h"
@@ -415,21 +322,19 @@
class YGMultiSelectionBox : public YMultiSelectionBox, public YGTableView
{
public:
- YGMultiSelectionBox (const YWidgetOpt &opt, YGWidget *parent,
- const YCPString &label)
- : YMultiSelectionBox (opt, label),
- YGTableView (this, parent, opt, label)
+ YGMultiSelectionBox (YWidget *parent, const string &label)
+ : YMultiSelectionBox (NULL, label),
+ YGTableView (this, parent, label, false, false)
{
vector <GType> types;
types.push_back (G_TYPE_BOOLEAN);
types.push_back (GDK_TYPE_PIXBUF);
types.push_back (G_TYPE_STRING);
- initModel (types, false);
-
- insertColumn (0, "", G_TYPE_BOOLEAN);
- insertColumn (2, "", G_TYPE_STRING);
- setSearchCol (2);
- // pixbuf column will be added later, if needed
+ createModel (types);
+ addColumn (G_TYPE_BOOLEAN, "", YAlignUnchanged, 0);
+ addColumn (GDK_TYPE_PIXBUF, "", YAlignUnchanged, 1);
+ addColumn (G_TYPE_STRING, "", YAlignUnchanged, 2);
+ gtk_tree_view_set_model (getView(), getModel());
g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
G_CALLBACK (selected_cb), (YGTableView*) this);
@@ -439,85 +344,115 @@
}
// YMultiSelectionBox
- virtual int getCurrentItem()
- { IMPL; return getCurrentRow(); }
-
- virtual void setCurrentItem (int index)
- { IMPL; setCurrentRow (index); }
+ virtual void addItem (YItem *item)
+ {
+ GtkTreeIter iter;
+ addRow (&iter, item);
+ setCellToggle (&iter, 0, item->selected());
+ setCellIcon (&iter, 1, item->iconName());
+ setCellLabel (&iter, 2, item->label());
+ YMultiSelectionBox::addItem (item);
+ }
- // YSelectionWidget
- virtual void itemAdded (const YCPString &str, int index, bool selected)
+ virtual void selectItem (YItem *item, bool select)
{
- IMPL
- addRow (index);
+ GtkTreeIter iter;
+ if (getIter (item, &iter))
+ setCellToggle (&iter, 0, select);
+ YMultiSelectionBox::selectItem (item);
+ }
- if (hasIcons()) {
- if (m_colsNb == 2) // make space for pixbufs
- insertColumn (1, "", GDK_TYPE_PIXBUF);
- setItemIcon (itemIcon (index)->value(), index, 1);
+ virtual void deselectAllItems()
+ {
+ GtkTreeIter iter;
+ if (gtk_tree_model_get_iter_first (getModel(), &iter)) {
+ do {
+ setCellToggle (&iter, 0, false);
+ } while (gtk_tree_model_iter_next (getModel(), &iter));
}
- setItemBool (selected, index, 0);
- setItemText (str->value(), index, 2);
+ YMultiSelectionBox::deselectAllItems();
}
- virtual void deleteAllItems()
- { IMPL; deleteRows(); }
+ virtual YItem *currentItem()
+ { return focusItem(); }
- // Toggle related methods follow
- /* Returns the state of the toggle at the row "index".
- Pass -1 for query only. 0 and 1 to set it false or true. */
- bool itemSelected (int id, int state)
- {
- IMPL
- GtkTreeIter iter;
- if (!getRowOf (&iter, id))
- throw "Row doesn't exist";
+ virtual void setCurrentItem (YItem *item)
+ { implFocusItem (item); }
- if (state != -1)
- gtk_list_store_set (getStore(), &iter, 0, state, -1);
- gtk_tree_model_get (getModel(), &iter, 0, &state, -1);
- return state;
+ virtual void setFocusItem (GtkTreeIter *iter, bool addingRow)
+ {
+ // item->selected() doesn't apply to focus, filter them
+ if (!addingRow)
+ YGTableView::setFocusItem (iter, addingRow);
}
- virtual bool itemIsSelected (int index)
+ // Events
+ static void multi_activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
+ GtkTreeViewColumn *column, YGMultiSelectionBox* pThis)
{
IMPL
- bool state = 0;
- try { state = itemSelected (index, -1); }
- catch (char *str) { y2error ("%s - itemIsSelected(%d): %s - ignoring",
- YMultiSelectionBox::widgetClass(), index, str); }
- return state;
+ pThis->toggle (path, 0);
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGSELECTION_WIDGET_IMPL_CLEAR (YMultiSelectionBox)
+};
+
+YMultiSelectionBox *YGWidgetFactory::createMultiSelectionBox (YWidget *parent,
+ const string &label)
+{
+ IMPL
+ return new YGMultiSelectionBox (parent, label);
+}
+
+#include "YTree.h"
+
+class YGTree : public YTree, public YGTableView
+{
+public:
+ YGTree (YWidget *parent, const string &label)
+ : YTree (NULL, label)
+ , YGTableView (this, parent, label, true, true)
+ {
+ g_signal_connect (G_OBJECT (getWidget()), "row-activated",
+ G_CALLBACK (activated_cb), (YGTableView*) this);
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_cb), (YGTableView*) this);
}
- virtual void selectItem (int index)
+ // YTree
+ virtual void rebuildTree()
{
- IMPL
- try { itemSelected (index, 1); }
- catch (char *str) { y2error ("%s - selectItem(%d): %s - ignoring",
- YMultiSelectionBox::widgetClass(), index, str); }
+ doDeleteAllItems();
+ for (YItemConstIterator it = itemsBegin(); it != itemsEnd(); it++)
+ doAddItem (*it);
}
- virtual void deselectAllItems()
+ virtual const YTreeItem *getCurrentItem() const
{
- for (int i = 0; ; i++)
- try { itemSelected (i, false); }
- catch (...) { break; }
+ YGTree *pThis = const_cast <YGTree *> (this);
+ return (YTreeItem *) pThis->focusItem();
}
- static void multi_activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
- GtkTreeViewColumn *column, YGMultiSelectionBox* pThis)
+ virtual void setCurrentItem (YTreeItem *item)
+ { implFocusItem ((YItem *) item); }
+
+ // YGSelectionModel
+ virtual void expand (GtkTreeIter *iter)
{
- IMPL
- pThis->toggle (path, 0);
+ GtkTreePath *path = gtk_tree_model_get_path (getModel(), iter);
+ gtk_tree_view_expand_to_path (getView(), path);
+ gtk_tree_path_free (path);
}
YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YTree)
+ YGSELECTION_WIDGET_IMPL_CLEAR (YTree)
+ YGSELECTION_WIDGET_IMPL_SELECT (YTree)
};
-YWidget *
-YGUI::createMultiSelectionBox (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label)
+YTree *YGWidgetFactory::createTree (YWidget *parent, const string &label)
{
- IMPL
- return new YGMultiSelectionBox (opt, YGWidget::get (parent), label);
+ return new YGTree (parent, label);
}
+
Modified: trunk/gtk/src/YGUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=43216&r1=432…
==============================================================================
--- trunk/gtk/src/YGUI.cc (original)
+++ trunk/gtk/src/YGUI.cc Thu Dec 20 21:44:06 2007
@@ -6,11 +6,9 @@
#include <stdio.h>
#include <ycp/y2log.h>
#include <YEvent.h>
-#include <YDialog.h>
#include <YMacroRecorder.h>
#include "YGUI.h"
#include "YGUtils.h"
-#include "YGWidget.h"
#include "YGDialog.h"
#include <glib/gthread.h>
#include <sys/stat.h>
@@ -19,14 +17,8 @@
#define DEFAULT_MACRO_FILE_NAME "macro.ycp"
#define BUSY_CURSOR_TIMEOUT 250
-YGUI::YGUI (int argc, char ** argv,
- bool with_threads,
- const char *macro_file) :
- YUI (with_threads),
- busy_timeout (0),
- m_done_init (false),
- m_argc (0),
- m_argv (NULL)
+YGUI::YGUI (int argc, char **argv, bool with_threads, const char *macro_file)
+ : YUI (with_threads), busy_timeout (0), m_done_init (false), m_argc (0), m_argv (NULL)
{
IMPL
m_have_wm = true;
@@ -102,10 +94,8 @@
g_free (m_argv);
}
-static gboolean
-ycp_wakeup_fn (GIOChannel *source,
- GIOCondition condition,
- gpointer data)
+static gboolean ycp_wakeup_fn (GIOChannel *source, GIOCondition condition,
+ gpointer data)
{
*(int *)data = TRUE;
return TRUE;
@@ -119,10 +109,14 @@
}
}
-void
-YGUI::idleLoop (int fd_ycp)
+//#define PRINT_EVENTS
+
+void YGUI::idleLoop (int fd_ycp)
{
IMPL
+#ifdef PRINT_EVENTS
+fprintf (stderr, "idleLoop()\n");
+#endif
// The rational for this is that we need somewhere to run
// the magic 'main' thread, that can process thread unsafe
// incoming CORBA messages for us
@@ -141,6 +135,9 @@
g_source_remove (watch_tag);
g_io_channel_unref (wakeup);
+#ifdef PRINT_EVENTS
+fprintf (stderr, "no more idle\n");
+#endif
}
static gboolean user_input_timeout_cb (YGUI *pThis)
@@ -151,19 +148,20 @@
return FALSE;
}
-void
-YGUI::sendEvent (YEvent *event)
+void YGUI::sendEvent (YEvent *event)
{
m_event_handler.sendEvent (event);
g_main_context_wakeup (NULL);
}
// utility that implements both userInput() and pollInput()
-YEvent *
-YGUI::waitInput (unsigned long timeout_ms, bool block)
+YEvent *YGUI::waitInput (unsigned long timeout_ms, bool block)
{
IMPL
- if (!currentYGDialog())
+#ifdef PRINT_EVENTS
+fprintf (stderr, "%s()\n", block ? "userInput" : "pollInput");
+#endif
+ if (!YDialog::currentDialog (false))
return NULL;
if (block)
@@ -193,69 +191,61 @@
if (block) // if YCP keeps working for more than X time, set busy cursor
busy_timeout = g_timeout_add (BUSY_CURSOR_TIMEOUT, busy_timeout_cb, this);
+#ifdef PRINT_EVENTS
+fprintf (stderr, "returning event: %s\n", !event ? "(none)" : YEvent::toString (event->eventType()));
+#endif
return event;
}
-YEvent *
-YGUI::userInput (unsigned long timeout_ms)
-{
- return waitInput (timeout_ms, true);
-}
+YEvent *YGUI::userInput (unsigned long timeout_ms)
+{ return waitInput (timeout_ms, true); }
YEvent *YGUI::pollInput()
-{
- return waitInput (0, false);
-}
+{ return waitInput (0, false); }
-// dialog bits
-
-static GdkScreen *getScreen ()
-{
- return gdk_display_get_default_screen (gdk_display_get_default());
-}
+static inline GdkScreen *getScreen ()
+{ return gdk_display_get_default_screen (gdk_display_get_default()); }
int YGUI::getDisplayWidth()
-{
- IMPL
- return gdk_screen_get_width (getScreen());
-}
+{ return gdk_screen_get_width (getScreen()); }
int YGUI::getDisplayHeight()
-{
- IMPL
- return gdk_screen_get_height (getScreen());
-}
+{ return gdk_screen_get_height (getScreen()); }
-int YGUI::getDefaultSize (YUIDimension dim)
-{
- if (dim == YD_HORIZ) {
- if (!m_default_size.width) {
- if (m_fullscreen)
- m_default_size.width = getDisplayWidth();
- else
- m_default_size.width = MIN (600, getDisplayWidth());
- }
- return m_default_size.width;
- }
- else { // YD_VERT
- if (!m_default_size.height) {
- if (m_fullscreen)
- m_default_size.height = getDisplayHeight();
- else
- m_default_size.height = MIN (450, getDisplayHeight());
- }
- return m_default_size.height;
- }
+int YGUI::getDisplayDepth()
+{ return gdk_visual_get_best_depth(); }
+
+long YGUI::getDisplayColors()
+{ return 1L << getDisplayDepth(); /*from yast-qt*/ }
+
+// YCP writers use getDefaultWidth/Height() to do space saving if needed,
+// so just tell me the displayWidth/Height(). If that size is decent, let's
+// us deal with it.
+int YGUI::getDefaultWidth() { return getDisplayWidth(); }
+int YGUI::getDefaultHeight() { return getDisplayHeight(); }
+
+int YGUI::_getDefaultWidth()
+{
+ if (!m_default_size.width)
+ m_default_size.width = MIN (600, getDisplayWidth());
+ return m_default_size.width;
+}
+
+int YGUI::_getDefaultHeight()
+{
+ if (!m_default_size.height)
+ m_default_size.height = MIN (450, getDisplayHeight());
+ return m_default_size.height;
}
// YWidget layout units -> pixels conversion. Same as yast-qt's.
-long YGUI::deviceUnits (YUIDimension dim, float size)
+int YGUI::deviceUnits (YUIDimension dim, float size)
{
if (dim == YD_HORIZ) return (long) ((size * (640.0/80)) + 0.5);
else return (long) ((size * (480.0/25)) + 0.5);
}
-float YGUI::layoutUnits (YUIDimension dim, long device_units)
+float YGUI::layoutUnits (YUIDimension dim, int device_units)
{
float size = (float) device_units;
if (dim == YD_HORIZ) return size * (80/640.0);
@@ -274,7 +264,7 @@
void YGUI::internalError (const char *msg)
{
errorMsg (msg);
- abort(); // going down
+ abort(); // going down
}
/* File/directory dialogs. */
@@ -287,9 +277,9 @@
IMPL
GtkWidget *dialog;
dialog = gtk_file_chooser_dialog_new (title->value_cstr(),
- YGUI::ui()->currentWindow(), action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- action == GTK_FILE_CHOOSER_ACTION_SAVE ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
+ YGDialog::currentWindow(), action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ action == GTK_FILE_CHOOSER_ACTION_SAVE ? GTK_STOCK_SAVE : GTK_STOCK_OPEN,
+ GTK_RESPONSE_ACCEPT, NULL);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
// Yast likes to pass the path and suggested filename as a whole. We will need to
@@ -383,15 +373,6 @@
return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SAVE, path, filter, title);
}
-bool YGUI::textMode() IMPL_RET(false)
-bool YGUI::hasImageSupport() IMPL_RET(true)
-bool YGUI::hasLocalImageSupport() IMPL_RET(true)
-bool YGUI::hasAnimationSupport() IMPL_RET(true)
-bool YGUI::hasIconSupport() IMPL_RET(true)
-bool YGUI::hasFullUtf8Support() IMPL_RET(true)
-bool YGUI::richTextSupportsTable() IMPL_RET(false)
-bool YGUI::leftHandedMouse() IMPL_RET(false)
-
gboolean YGUI::busy_timeout_cb (gpointer data)
{
YGUI *pThis = (YGUI *) data;
@@ -402,7 +383,7 @@
void YGUI::busyCursor()
{
- YGDialog *dialog = currentYGDialog();
+ YGDialog *dialog = YGDialog::currentDialog();
if (dialog)
dialog->busyCursor();
}
@@ -414,42 +395,27 @@
busy_timeout = 0;
}
- YGDialog *dialog = currentYGDialog();
+ YGDialog *dialog = YGDialog::currentDialog();
if (dialog)
dialog->normalCursor();
}
-void YGUI::redrawScreen()
-{
- gtk_widget_queue_draw (GTK_WIDGET (currentWindow()));
-}
-
YCPValue YGUI::runPkgSelection (YWidget *packageSelector)
{
- y2milestone ("Running package selection...");
-
- // TODO: we may have to do some trickery here to disable close button
- // and auto activate dialogs (whatever that is)
-// _wm_close_blocked = true;
-// _auto_activate_dialogs = false;
-
+ y2milestone( "Running package selection..." );
YCPValue input = YCPVoid();
+
try {
input = evaluateUserInput();
- }
- catch (const std::exception &e) {
- y2error ("Caught std::exception: %s", e.what());
- y2error ("This is a libzypp problem. Do not file a bug against the UI!");
- }
- catch (...) {
- y2error ("Caught unspecified exception.");
- y2error ("This is a libzypp problem. Do not file a bug against the UI!");
+ } catch (const std::exception &e) {
+ y2error ("UI::RunPkgSelection() error: %s", e.what());
+ y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
+ } catch (...) {
+ y2error ("UI::RunPkgSelection() error (unspecified)");
+ y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
}
-// _auto_activate_dialogs = true;
-// _wm_close_blocked = false;
y2milestone ("Package selection done - returning %s", input->toString().c_str());
-
return input;
}
@@ -458,7 +424,7 @@
IMPL
bool interactive = filename.empty();
- GtkWidget *widget = GTK_WIDGET (currentWindow());
+ GtkWidget *widget = GTK_WIDGET (YGDialog::currentWindow());
if (!widget) {
if (interactive)
errorMsg ("No dialog to take screenshot of.");
@@ -542,7 +508,7 @@
if (recordingMacro()) {
// save the taking of the screenshot and its name to the macro
macroRecorder->beginBlock();
- currentDialog()->saveUserInput (macroRecorder);
+ YDialog::currentDialog()->saveUserInput (macroRecorder);
macroRecorder->recordMakeScreenShot (true, filename.c_str());
macroRecorder->recordUserInput (YCPVoid());
macroRecorder->endBlock();
@@ -555,7 +521,7 @@
void YGUI::beep()
{
gdk_beep();
- GtkWindow *window = currentWindow();
+ GtkWindow *window = YGDialog::currentWindow();
if (window)
gtk_window_present (window);
}
@@ -642,7 +608,19 @@
}
}
-// debug dialogs
+YGApplication::YGApplication()
+{
+ setIconBasePath (ICON_DIR);
+}
+
+YWidgetFactory *YGUI::createWidgetFactory()
+{ return new YGWidgetFactory; }
+YOptionalWidgetFactory *YGUI::createOptionalWidgetFactory()
+{ return new YGOptionalWidgetFactory; }
+YApplication *YGUI::createApplication()
+{ return new YGApplication(); }
+
+//** debug dialogs
//#define IS_VALID_COL
void dumpYastTree (YWidget *widget)
@@ -659,10 +637,9 @@
GtkTreeIter iter;
gtk_tree_store_append (store, &iter, parent_node);
- YContainerWidget *container = dynamic_cast <YContainerWidget *> (widget);
gchar *stretch = g_strdup_printf ("%d x %d",
- ygwidget->isStretchable (YD_HORIZ), ygwidget->isStretchable (YD_VERT));
- gchar *weight = g_strdup_printf ("%ld x %ld",
+ widget->stretchable (YD_HORIZ), widget->stretchable (YD_VERT));
+ gchar *weight = g_strdup_printf ("%d x %d",
widget->weight (YD_HORIZ), widget->weight (YD_VERT));
gtk_tree_store_set (store, &iter, 0, widget->widgetClass(),
1, ygwidget->getDebugLabel().c_str(), 2, stretch, 3, weight,
@@ -673,9 +650,9 @@
g_free (stretch);
g_free (weight);
- if (container)
- for (int i = 0; i < container->numChildren(); i++)
- dumpYastTree (container->child (i), store, &iter);
+ for (YWidgetListConstIterator it = widget->childrenBegin();
+ it != widget->childrenEnd(); it++)
+ dumpYastTree (*it, store, &iter);
}
static void dialog_response_cb (GtkDialog *dialog, gint response, YWidget *ywidget)
{
@@ -765,7 +742,7 @@
YRichText *rtext = dynamic_cast <YRichText *> (widget);
if (rtext) {
- std::string text = rtext->getText()->value();
+ std::string text = rtext->text();
char *xml = ygutils_convert_to_xhmlt_and_subst (text.c_str(), NULL);
GtkWidget *view = gtk_text_view_new();
@@ -786,10 +763,9 @@
g_free (xml);
}
- YContainerWidget *container = dynamic_cast <YContainerWidget *> (widget);
- if (container)
- for (int i = 0; i < container->numChildren(); i++)
- dumpYastHtml (container->child (i), box);
+ for (YWidgetListConstIterator it = widget->childrenBegin();
+ it != widget->childrenEnd(); it++)
+ dumpYastHtml (*it, box);
}
static void destroy_dialog (GtkDialog *dialog, gint arg)
{ gtk_widget_destroy (GTK_WIDGET (dialog)); }
Modified: trunk/gtk/src/YGUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=43216&r1=4321…
==============================================================================
--- trunk/gtk/src/YGUI.h (original)
+++ trunk/gtk/src/YGUI.h Thu Dec 20 21:44:06 2007
@@ -7,10 +7,8 @@
#include <gtk/gtk.h>
#include <YSimpleEventHandler.h>
-#include <YUI.h>
-using std::string;
-using std::vector;
+#define ICON_DIR THEMEDIR "/icons/22x22/apps/"
/* Comment the following line to disable debug messages */
// #define IMPL_DEBUG
@@ -20,13 +18,10 @@
#else
#define IMPL { }
#endif
-#define IMPL_NULL { IMPL; return NULL; }
-#define IMPL_VOID { IMPL; return YCPVoid(); }
#define IMPL_RET(a) { IMPL; return (a); }
-#define ICON_DIR THEMEDIR "/icons/22x22/apps/"
-
/* Compatibility */
+/*
#if YAST2_VERSION > 2014004
# define YAST2_YGUI_CHECKBOX_FRAME 1
#elif YAST2_VERSION >= 2014000
@@ -36,9 +31,12 @@
#else
# define YAST2_YGUI_CHECKBOX_FRAME 0
#endif
+*/
class YGDialog;
+#include <YUI.h>
+
class YGUI: public YUI
{
public:
@@ -46,233 +44,56 @@
bool with_threads, const char *macro_file);
virtual ~YGUI();
- static YGUI *ui() { return (YGUI *)YUI::ui(); }
-
- // non abstract loop bits:
- virtual void blockEvents (bool block = true) IMPL
- virtual bool eventsBlocked() const IMPL_RET (false)
- virtual void internalError (const char *msg);
- virtual void idleLoop (int fd_ycp);
- virtual YEvent * waitInput (unsigned long timeout_ms, bool block);
- virtual YEvent * userInput (unsigned long timeout_millisec);
- virtual YEvent * pollInput();
-
- virtual void showDialog (YDialog *dialog);
- virtual void closeDialog (YDialog *dialog);
- // Non abstract virtuals:
- virtual YCPValue setLanguage (const YCPTerm & term) IMPL_VOID
+ static YGUI *ui() { return (YGUI *) YUI::ui(); }
- // event pieces:
- private:
- YSimpleEventHandler m_event_handler;
- public:
- void sendEvent (YEvent *event);
- YEvent *pendingEvent() const { return m_event_handler.pendingEvent(); }
- bool eventPendingFor (YWidget *widget) const { return m_event_handler.eventPendingFor (widget); }
+protected:
+ virtual YWidgetFactory *createWidgetFactory();
+ virtual YOptionalWidgetFactory *createOptionalWidgetFactory();
+ virtual YApplication *createApplication();
- // container widgets
- virtual YDialog *createDialog (YWidgetOpt &opt);
- virtual YContainerWidget *createSplit (YWidget *parent, YWidgetOpt &opt, YUIDimension dimension);
- virtual YContainerWidget *createReplacePoint (YWidget *parent, YWidgetOpt &opt);
- virtual YContainerWidget *createAlignment (YWidget *parent, YWidgetOpt &opt,
- YAlignmentType halign,
- YAlignmentType valign);
- virtual YContainerWidget *createSquash (YWidget *parent, YWidgetOpt &opt,
- bool hsquash, bool vsquash);
- virtual YContainerWidget *createRadioButtonGroup (YWidget *parent, YWidgetOpt &opt);
- virtual YContainerWidget *createFrame (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label);
-#if YAST2_YGUI_CHECKBOX_FRAME
- virtual YContainerWidget *createCheckBoxFrame( YWidget *parent, YWidgetOpt & opt, const YCPString & label, bool checked );
-#endif
-
- // leaf widgets
- virtual YWidget *createEmpty (YWidget *parent, YWidgetOpt &opt);
- virtual YWidget *createSpacing (YWidget *parent, YWidgetOpt &opt, float size,
- bool horizontal, bool vertical);
- virtual YWidget *createLabel (YWidget *parent, YWidgetOpt &opt,
- const YCPString &text);
- virtual YWidget *createRichText (YWidget *parent, YWidgetOpt &opt,
- const YCPString &text);
- virtual YWidget *createLogView (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, int visibleLines,
- int maxLines);
- virtual YWidget *createPushButton (YWidget *parent, YWidgetOpt &opt,
- const YCPString & label);
- virtual YWidget *createMenuButton (YWidget *parent, YWidgetOpt &opt,
- const YCPString & label);
- virtual YWidget *createRadioButton (YWidget *parent, YWidgetOpt &opt,
- YRadioButtonGroup *rbg,
- const YCPString &label, bool checked);
- virtual YWidget *createCheckBox (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, bool checked);
- virtual YWidget *createTextEntry (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, const YCPString &text);
- virtual YWidget *createMultiLineEdit (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label,
- const YCPString &text);
- virtual YWidget *createSelectionBox (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label);
- virtual YWidget *createMultiSelectionBox (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label);
- virtual YWidget *createComboBox (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label);
- virtual YWidget *createTree (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label);
- virtual YWidget *createTable (YWidget *parent, YWidgetOpt &opt,
- std::vector<std::string> header);
- virtual YWidget *createProgressBar (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label,
- const YCPInteger &maxprogress,
- const YCPInteger &progress);
- virtual YWidget *createImage (YWidget *parent, YWidgetOpt &opt,
- YCPByteblock imagedata, YCPString defaulttext);
- virtual YWidget *createImage (YWidget *parent, YWidgetOpt &opt,
- YCPString file_name, YCPString defaulttext);
- virtual YWidget *createIntField (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, int minValue,
- int maxValue, int initialValue);
-
- // Package selector
- virtual YWidget *createPackageSelector (YWidget *parent, YWidgetOpt &opt,
- const YCPString &floppyDevice);
- virtual YWidget *createPkgSpecial (YWidget *parent, YWidgetOpt &opt,
- const YCPString &subwidget);
- virtual YCPValue runPkgSelection (YWidget *packageSelector);
-
-/*
- // FIXME: do we need to implement these new bits ?
-
- // New package selector bits ...
- bool hasPatternSelector();
- YWidget * createPatternSelector ( YWidget * parent,
- YWidgetOpt & opt );
-
- bool hasSimplePatchSelector();
- YWidget * createSimplePatchSelector( YWidget * parent,
- YWidgetOpt & opt );
-*/
-
- // Optional widgets
- virtual YWidget *createDummySpecialWidget (YWidget *parent, YWidgetOpt &opt)
- IMPL_NULL;
- virtual bool hasDummySpecialWidget() { return false; }
-
- virtual YWidget *createDownloadProgress (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label,
- const YCPString &filename,
- int expectedSize);
- virtual bool hasDownloadProgress() { return true; }
-
- virtual YWidget *createBarGraph (YWidget *parent, YWidgetOpt &opt);
- virtual bool hasBarGraph() { return true; }
-
- virtual YWidget *createColoredLabel (YWidget *parent, YWidgetOpt &opt,
- YCPString label, YColor foreground,
- YColor background, int margin);
- virtual bool hasColoredLabel() { return true; }
-
- virtual YWidget *createDate (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, const YCPString &date);
- virtual bool hasDate() { return true; }
-
- virtual YWidget *createTime (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, const YCPString &time);
- virtual bool hasTime() { return true; }
-
- virtual YWidget *createDumbTab (YWidget *parent, YWidgetOpt &opt);
- virtual bool hasDumbTab() { return true; }
-
- virtual YWidget *createMultiProgressMeter (YWidget *parent, YWidgetOpt &opt,
- bool horizontal, const YCPList & maxValues);
- virtual bool hasMultiProgressMeter() { return true; }
-
- virtual YWidget *createSlider (YWidget *parent, YWidgetOpt &opt,
- const YCPString &label, int min,
- int max, int initial);
- virtual bool hasSlider() { return true; }
-
- virtual YWidget *createPartitionSplitter (YWidget *parent,
- YWidgetOpt &opt,
- int usedSize,
- int totalFreeSize,
- int newPartSize,
- int minNewPartSize,
- int minFreeSize,
- const YCPString &usedLabel,
- const YCPString &freeLabel,
- const YCPString &newPartLabel,
- const YCPString &freeFieldLabel,
- const YCPString &newPartFieldLabel);
- virtual bool hasPartitionSplitter() { return true; }
-
- virtual YWidget *createPatternSelector (YWidget *parent, YWidgetOpt &opt) IMPL_NULL;
- virtual bool hasPatternSelector() { return false; }
-
- virtual YWidget *createWizard (YWidget *parent,
- YWidgetOpt &opt,
- const YCPValue &backButtonId,
- const YCPString &backButtonLabel,
- const YCPValue &abortButtonId,
- const YCPString &abortButtonLabel,
- const YCPValue &nextButtonId,
- const YCPString &nextButtonLabel);
- virtual bool hasWizard() { return true; }
-
-
- virtual int getDisplayWidth();
- virtual int getDisplayHeight();
- // let's fool YWidgets here because it tries to be smart if our default
- // dialog size is too small
- virtual int getDefaultWidth() { return 10000; }
- virtual int getDefaultHeight() { return 10000; }
- // Dunno where this is used in practice, but these can be got by a YCP
- // apps, so better implement them.
- virtual int getDisplayDepth() { return 24; }
- virtual long getDisplayColors() { return 256*256*256; }
-
- virtual long deviceUnits (YUIDimension dim, float size);
- virtual float layoutUnits (YUIDimension dim, long device_units);
-
- virtual bool textMode();
- virtual bool hasImageSupport();
- virtual bool hasLocalImageSupport();
- virtual bool hasAnimationSupport();
- virtual bool hasIconSupport();
- virtual bool hasFullUtf8Support();
- virtual bool richTextSupportsTable();
- virtual bool leftHandedMouse();
-
- virtual YCPString glyph (const YCPSymbol &glyph);
- virtual void redrawScreen();
-
- // convience function to be used rather than currentDialog()
- // NULL if there is no dialog at the moment.
- GtkWindow *currentWindow();
- YGDialog *currentYGDialog();
-
- virtual void busyCursor();
- virtual void normalCursor();
-
- guint busy_timeout; // for busy cursor
- static gboolean busy_timeout_cb (gpointer data);
-
- virtual void beep();
- virtual void makeScreenShot (string filename);
+public:
+ YEvent *waitInput (unsigned long timeout_ms, bool block);
+ virtual void idleLoop (int fd_ycp);
+ virtual YEvent *userInput (unsigned long timeout_millisec);
+ virtual YEvent *pollInput();
+
+ virtual void internalError (const char *msg);
+
+ virtual int deviceUnits (YUIDimension dim, float layout_units);
+ virtual float layoutUnits (YUIDimension dim, int device_units);
+ virtual YCPString glyph (const YCPSymbol &glyphSymbol);
+
+ virtual int getDisplayWidth();
+ virtual int getDisplayHeight();
+ virtual int getDisplayDepth();
+ virtual long getDisplayColors();
+ virtual int getDefaultWidth();
+ virtual int getDefaultHeight();
+ virtual bool textMode() IMPL_RET (false)
+ virtual bool hasImageSupport() IMPL_RET (true)
+ virtual bool hasLocalImageSupport() IMPL_RET (true)
+ virtual bool hasAnimationSupport() IMPL_RET (true)
+ virtual bool hasIconSupport() IMPL_RET (true)
+ virtual bool hasFullUtf8Support() IMPL_RET (true)
+ virtual bool richTextSupportsTable() IMPL_RET (false)
+
+ virtual void showDialog (YDialog *dialog);
+ virtual void closeDialog (YDialog *dialog);
+
+ virtual void busyCursor();
+ virtual void normalCursor();
+
+ virtual void makeScreenShot (string filename);
+ virtual void beep();
+ virtual YCPValue runPkgSelection (YWidget *packageSelector);
+
+ virtual YCPValue askForExistingDirectory (const YCPString &startDir,
+ const YCPString &headline);
+ virtual YCPValue askForExistingFile (const YCPString &startWith,
+ const YCPString &filter, const YCPString &headline);
+ virtual YCPValue askForSaveFileName (const YCPString &startWith,
+ const YCPString & filter, const YCPString &headline);
- /* File/directory dialogs. */
- virtual YCPValue askForExistingDirectory (const YCPString &startDir,
- const YCPString &headline);
- virtual YCPValue askForExistingFile (const YCPString &startWith,
- const YCPString &filter,
- const YCPString &headline);
- virtual YCPValue askForSaveFileName (const YCPString &startWith,
- const YCPString &filter,
- const YCPString &headline);
-
- // Starts macro recording and asks for a filename to save it to
- // If there is already one in progress, it just resumes/pauses as appropriate
- // activated by Ctrl-Shift-Alt-M
void toggleRecordMacro();
// Plays a macro, opening a dialog first to ask for the filename
@@ -282,7 +103,16 @@
// On Shift-F8, run save_logs
void askSaveLogs();
- private:
+ YSimpleEventHandler m_event_handler;
+ void sendEvent (YEvent *event);
+ YEvent *pendingEvent() const { return m_event_handler.pendingEvent(); }
+ bool eventPendingFor (YWidget *widget) const
+ { return m_event_handler.eventPendingFor (widget); }
+
+private:
+ guint busy_timeout; // for busy cursor
+ static gboolean busy_timeout_cb (gpointer data);
+
// window-related arguments
bool m_have_wm, m_no_border, m_fullscreen;
GtkRequisition m_default_size;
@@ -297,10 +127,10 @@
map <string, int> screenShotNb;
string screenShotNameTemplate;
- public:
+public:
// Helpers for internal use [ visibility hidden ]
- int getDefaultSize (YUIDimension dim);
- bool setFullscreen() const { return m_fullscreen || !m_have_wm; }
+ int _getDefaultWidth(); int _getDefaultHeight();
+ bool setFullscreen() const { return m_fullscreen; }
bool hasWM() const { return m_have_wm; }
bool unsetBorder() const { return m_no_border; }
};
@@ -309,5 +139,105 @@
void dumpYastTree (YWidget *widget);
void dumpYastHtml (YWidget *widget);
-#endif // YGUI_H
+#include <YWidgetFactory.h>
+
+class YGWidgetFactory : public YWidgetFactory
+{
+ virtual YDialog *createDialog (YDialogType dialogType, YDialogColorMode colorMode);
+
+ virtual YPushButton *createPushButton (YWidget *parent, const string &label);
+ virtual YLabel *createLabel (YWidget *parent, const string &text, bool isHeading, bool isOutputField);
+ virtual YInputField *createInputField (YWidget *parent, const string &label, bool passwordMode);
+ virtual YCheckBox *createCheckBox (YWidget *parent, const string &label, bool isChecked);
+ virtual YRadioButton *createRadioButton (YWidget *parent, const string &label, bool isChecked);
+ virtual YComboBox *createComboBox (YWidget * parent, const string & label, bool editable);
+ virtual YSelectionBox *createSelectionBox (YWidget *parent, const string &label);
+ virtual YTree *createTree (YWidget *parent, const string &label);
+ virtual YTable *createTable (YWidget * parent, YTableHeader *header);
+ virtual YProgressBar *createProgressBar (YWidget *parent, const string &label, int maxValue);
+ virtual YRichText *createRichText (YWidget *parent, const string &text, bool plainTextMode);
+
+ virtual YIntField *createIntField (YWidget *parent, const string &label, int minVal, int maxVal, int initialVal);
+ virtual YMenuButton *createMenuButton (YWidget *parent, const string &label);
+ virtual YMultiLineEdit *createMultiLineEdit (YWidget *parent, const string &label);
+ virtual YImage *createImage (YWidget *parent, const string &imageFileName, bool animated);
+ virtual YLogView *createLogView (YWidget *parent, const string &label, int visibleLines, int storedLines);
+ virtual YMultiSelectionBox *createMultiSelectionBox (YWidget *parent, const string &label);
+
+ virtual YPackageSelector *createPackageSelector (YWidget * parent, long ModeFlags);
+ virtual YWidget *createPkgSpecial (YWidget * parent, const string & subwidgetName)
+ IMPL_RET (NULL) // for ncurses
+
+ virtual YLayoutBox *createLayoutBox (YWidget *parent, YUIDimension dimension);
+
+ virtual YSpacing *createSpacing (YWidget *parent, YUIDimension dim, bool stretchable, YLayoutSize_t size);
+ virtual YEmpty *createEmpty (YWidget *parent);
+ virtual YAlignment *createAlignment (YWidget *parent, YAlignmentType horAlignment, YAlignmentType vertAlignment);
+ virtual YSquash *createSquash (YWidget *parent, bool horSquash, bool vertSquash);
+
+ virtual YFrame *createFrame (YWidget *parent, const string &label);
+ virtual YCheckBoxFrame *createCheckBoxFrame (YWidget *parent, const string &label, bool checked);
+
+ virtual YRadioButtonGroup *createRadioButtonGroup (YWidget *parent);
+ virtual YReplacePoint *createReplacePoint (YWidget *parent);
+};
+
+#include <YOptionalWidgetFactory.h>
+
+class YGOptionalWidgetFactory : public YOptionalWidgetFactory
+{
+public:
+ virtual bool hasWizard() IMPL_RET (true)
+ virtual YWizard *createWizard (YWidget *parent, const string &backButtonLabel,
+ const string &abortButtonLabel, const string &nextButtonLabel,
+ YWizardMode wizardMode);
+
+ virtual bool hasDumbTab() IMPL_RET (true)
+ virtual YDumbTab *createDumbTab (YWidget *parent);
+
+ virtual bool hasSlider() IMPL_RET (true)
+ virtual YSlider *createSlider (YWidget *parent, const string &label, int minVal,
+ int maxVal, int initialVal);
+
+ virtual bool hasDateField() IMPL_RET (true)
+ virtual YDateField *createDateField (YWidget *parent, const string &label);
+
+ virtual bool hasTimeField() IMPL_RET (true)
+ virtual YTimeField *createTimeField (YWidget *parent, const string &label);
+
+ virtual bool hasBarGraph() IMPL_RET (true)
+ virtual YBarGraph *createBarGraph (YWidget *parent);
+
+ virtual bool hasMultiProgressMeter() IMPL_RET (true)
+ virtual YMultiProgressMeter *createMultiProgressMeter (YWidget *parent,
+ YUIDimension dim, const vector<float> &maxValues);
+
+ virtual bool hasPartitionSplitter() IMPL_RET (true)
+ virtual YPartitionSplitter *createPartitionSplitter (YWidget *parent,
+ int usedSize, int totalFreeSize, int newPartSize, int minNewPartSize,
+ int minFreeSize, const string &usedLabel, const string &freeLabel,
+ const string &newPartLabel, const string &freeFieldLabel,
+ const string &newPartFieldLabel);
+
+ virtual bool hasDownloadProgress() IMPL_RET (true)
+ virtual YDownloadProgress *createDownloadProgress (YWidget *parent,
+ const string &label, const string & filename, YFileSize_t expectedFileSize);
+
+ virtual bool hasSimplePatchSelector() IMPL_RET (false)
+ virtual YWidget *createSimplePatchSelector (YWidget *parent, long modeFlags)
+ IMPL_RET (NULL)
+ virtual bool hasPatternSelector() IMPL_RET (false)
+ virtual YWidget *createPatternSelector (YWidget *parent, long modeFlags)
+ IMPL_RET (NULL)
+};
+
+#include <YApplication.h>
+
+class YGApplication : public YApplication
+{
+public:
+ YGApplication();
+};
+
+#endif /*YGUI_H*/
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=43216&r1=…
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Thu Dec 20 21:44:06 2007
@@ -3,16 +3,16 @@
********************************************************************/
#include <config.h>
-#include <YGUI.h>
+#include <ycp/y2log.h>
+#include "YGUI.h"
#include "YGUtils.h"
-string YGUtils::mapKBAccel (const char *src)
+string YGUtils::mapKBAccel (const string &src)
{
// we won't use use replace since we also want to escape _ to __
+ int length = src.length();
string str;
- int length = strlen (src);
str.reserve (length);
-
for (int i = 0; i < length; i++) {
if (src[i] == '_')
str += "__";
@@ -24,46 +24,46 @@
return str;
}
-string YGUtils::filterText (const char* text, int length, const char *valid_chars)
+void YGUtils::setFilter (GtkEntry *entry, const string &validChars)
{
- if (length == -1)
- length = strlen (text);
- if (valid_chars[0] == '\0')
- return string(text);
-
- string str;
- str.reserve (length);
- for (int i = 0; text[i] && i < length; i++) {
- for (int j = 0; valid_chars[j]; j++)
- if(text[i] == valid_chars[j]) {
- str += text[i];
- break;
+ struct inner {
+ static void insert_text_cb (GtkEditable *editable, const gchar *new_text,
+ gint new_text_length, gint *pos)
+ {
+ const gchar *valid_chars = (gchar *) g_object_get_data (G_OBJECT (editable),
+ "valid-chars");
+ if (valid_chars) {
+ const gchar *i, *j;
+ for (i = new_text; *i; i++) {
+ for (j = valid_chars; *j; j++) {
+ if (*i == *j)
+ break;
+ }
+ if (!*j) {
+ // not valid text
+ g_signal_stop_emission_by_name (editable, "insert_text");
+ gdk_beep();
+ return;
+ }
+ }
}
- }
- return str;
-}
-
-void YGUtils::filterText (GtkEditable *editable, int pos, int length,
- const char *valid_chars)
-{
- gchar *text = gtk_editable_get_chars (editable, pos, pos + length);
- string str = filterText (text, length, valid_chars);
- if (length == -1)
- length = strlen (text);
-
- if (str != text) { // invalid text
- // delete current text
- gtk_editable_delete_text (editable, pos, length);
- // insert correct text
- gtk_editable_insert_text (editable, str.c_str(), str.length(), &pos);
+ }
+ };
- g_signal_stop_emission_by_name (editable, "insert_text");
- gdk_beep(); // BEEP!
+ if (!validChars.empty()) {
+ gchar *chars = g_strdup (validChars.c_str());
+ g_object_set_data_full (G_OBJECT (entry), "valid-chars", chars, g_free);
+ g_signal_connect (G_OBJECT (entry), "insert-text",
+ G_CALLBACK (inner::insert_text_cb), NULL);
}
-
- g_free (text);
+ else
+ g_object_disconnect (G_OBJECT (entry), "insert-text",
+ G_CALLBACK (inner::insert_text_cb), NULL);
}
+void ygutils_setFilter (GtkEntry *entry, const char *validChars)
+{ YGUtils::setFilter (entry, validChars); }
+
void YGUtils::replace (string &str, const char *mouth, int mouth_len, const char *food)
{
if (mouth_len < 0)
@@ -460,151 +460,6 @@
return parts;
}
-void YGUtils::print_model (GtkTreeModel *model, int string_col)
-{
- fprintf (stderr, "printing model...\n");
- int depth = 0;
- GtkTreeIter iter;
-
- if (!gtk_tree_model_get_iter_first (model, &iter)) {
- fprintf (stderr, "Couldn't even get a first iterator\n");
- return;
- }
-
- while (true)
- {
- // print node
- gchar *package_name = 0;
- gtk_tree_model_get (model, &iter, string_col, &package_name, -1);
- for (int i = 0; i < depth*4; i++)
- fprintf (stderr, " ");
- fprintf (stderr, "%s\n", package_name);
- g_free (package_name);
-
- if (gtk_tree_model_iter_has_child (model, &iter)) {
- GtkTreeIter parent = iter;
- gtk_tree_model_iter_children (model, &iter, &parent);
- depth++;
- }
- else {
- if (gtk_tree_model_iter_next (model, &iter))
- ; // continue
- else {
- // let's see if there is a parent
- GtkTreeIter child = iter;
- if (gtk_tree_model_iter_parent (model, &iter, &child) &&
- gtk_tree_model_iter_next (model, &iter))
- depth--;
- else
- break;
- }
- }
- }
-}
-
-void YGUtils::tree_view_radio_toggle_cb (GtkCellRendererToggle *renderer,
- gchar *path_str, GtkTreeModel *model)
-{
- // Toggle the box
- GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
- gint *column = (gint*) g_object_get_data (G_OBJECT (renderer), "column");
- GtkTreeIter iter;
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_path_free (path);
-
- // Disable radio buttons from the same parent
- GtkTreeIter parent_iter, child_iter;
- if (gtk_tree_model_iter_parent (model, &parent_iter, &iter) &&
- gtk_tree_model_iter_children (model, &child_iter, &parent_iter)) {
- do gtk_tree_store_set (GTK_TREE_STORE (model), &child_iter, column, FALSE, -1);
- while (gtk_tree_model_iter_next (model, &child_iter));
- gtk_tree_store_set (GTK_TREE_STORE (model), &iter, column, TRUE, -1);
- }
-}
-
-gint YGUtils::sort_compare_cb (GtkTreeModel *model, GtkTreeIter *a,
- GtkTreeIter *b, gpointer data)
-{
- IMPL
- gint col = GPOINTER_TO_INT (data);
- gchar *str1 = 0, *str2 = 0;
- gtk_tree_model_get (model, a, col, &str1, -1);
- gtk_tree_model_get (model, b, col, &str2, -1);
- gint cmp = 0;
- if (str1 && str2)
- cmp = YGUtils::strcmp (str1, str2);
-
- if (str1)
- g_free (str1);
- if (str2)
- g_free (str2);
- return cmp;
-}
-
-static void header_clicked_cb (GtkTreeViewColumn *column, GtkTreeSortable *sortable)
-{
- IMPL
- GtkTreeViewColumn *last_sorted =
- (GtkTreeViewColumn *) g_object_get_data (G_OBJECT (sortable), "last-sorted");
- int id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (column), "id"));
-
- GtkSortType sort = GTK_SORT_ASCENDING;
- if (last_sorted != column) {
- if (last_sorted)
- gtk_tree_view_column_set_sort_indicator (last_sorted, FALSE);
- gtk_tree_view_column_set_sort_indicator (column, TRUE);
- g_object_set_data (G_OBJECT (sortable), "last-sorted", column);
- }
- else {
- sort = gtk_tree_view_column_get_sort_order (column);
- sort = sort == GTK_SORT_ASCENDING ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING;
- }
-
- gtk_tree_view_column_set_sort_order (column, sort);
- gtk_tree_sortable_set_sort_column_id (sortable, id, sort);
-}
-
-void YGUtils::tree_view_set_sortable (GtkTreeView *view, int default_sort_col)
-{
- IMPL
- g_assert (gtk_tree_view_get_headers_visible (view));
-
- /* Set all string columns clickable. */
- GtkTreeSortable *sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (view));
- // we need a pointer, this function is used by different stuff, so to we'll
- // use g_object_*_data() to do of garbage collector
- g_object_set_data (G_OBJECT (sortable), "last-sorted", NULL);
-
- GList *columns = gtk_tree_view_get_columns (view);
- for (GList *i = g_list_first (columns); i; i = i->next) {
- GtkTreeViewColumn *column = (GtkTreeViewColumn *) i->data;
- int col_nb = g_list_position (columns, i);
-
- // check if it really is a string column
- bool string_col = false;
- GList *renderers = gtk_tree_view_column_get_cell_renderers (column);
- for (GList *j = g_list_first (renderers); j; j = j->next)
- if (GTK_IS_CELL_RENDERER_TEXT (j->data)) {
- string_col = true;
- break;
- }
- g_list_free (renderers);
- if (!string_col)
- continue;
-
- // set sortable and clickable
- gtk_tree_sortable_set_sort_func (sortable, col_nb, sort_compare_cb,
- GINT_TO_POINTER (col_nb), NULL);
- g_object_set_data (G_OBJECT (column), "id", GINT_TO_POINTER (col_nb));
- gtk_tree_view_column_set_clickable (column, TRUE);
- g_signal_connect (G_OBJECT (column), "clicked",
- G_CALLBACK (header_clicked_cb), sortable);
- if (col_nb == default_sort_col)
- header_clicked_cb (column, sortable);
- }
- g_list_free (columns);
-}
-
GValue YGUtils::floatToGValue (float num)
{
GValue value = { 0 };
@@ -613,42 +468,17 @@
return value;
}
-#define SCROLLING_TIME 700
-#define SCROLLING_STEP 100
-struct ScrollData {
- int orix, oriy, diffx, diffy, time;
- GtkTreeView *view;
-};
-
-static gboolean scroll_timeout (gpointer _data) {
- ScrollData *data = (ScrollData *) _data;
- data->time += SCROLLING_STEP;
-
- int x = data->orix + data->diffx;
- int y = ((data->diffy * data->time) / SCROLLING_TIME) + data->oriy;
-
- gtk_tree_view_scroll_to_point (data->view, x, y);
- return data->time < SCROLLING_TIME;
-}
-
-void YGUtils::tree_view_smooth_scroll_to_point (GtkTreeView *view, gint x, gint y) {
- GdkRectangle rect;
- gtk_tree_view_get_visible_rect (view, &rect);
- if (rect.x == x && rect.y == y)
- return;
-
- ScrollData *data = (ScrollData *) g_malloc (sizeof (ScrollData));
- data->orix = rect.x;
- data->oriy = rect.y;
- data->diffx = x - rect.x;
- data->diffy = y - rect.y;
- data->time = 0;
- data->view = view;
-
- static int id = 0;
- if (id)
- g_source_remove (id);
- id = g_timeout_add_full (G_PRIORITY_DEFAULT, SCROLLING_STEP, scroll_timeout, data, g_free);
+GdkPixbuf *YGUtils::loadPixbuf (const string &filename)
+{
+ GdkPixbuf *pixbuf = NULL;
+ if (!filename.empty()) {
+ GError *error = 0;
+ pixbuf = gdk_pixbuf_new_from_file (filename.c_str(), &error);
+ if (!pixbuf)
+ y2warning ("Could not load icon: %s.\nReason: %s\n",
+ filename.c_str(), error->message);
+ }
+ return pixbuf;
}
#define ENGLISH_STOCK_ITEMS
Modified: trunk/gtk/src/YGUtils.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.h?rev=43216&r1=4…
==============================================================================
--- trunk/gtk/src/YGUtils.h (original)
+++ trunk/gtk/src/YGUtils.h Thu Dec 20 21:44:06 2007
@@ -8,7 +8,7 @@
#include <string>
#include <list>
#include <gtk/gtktextview.h>
-#include <gtk/gtkeditable.h>
+#include <gtk/gtkentry.h>
#include <gtk/gtktreeview.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtkcellrenderertoggle.h>
@@ -24,19 +24,10 @@
namespace YGUtils
{
/* Replaces Yast's '&' accelerator by Gnome's '_' (and proper escaping). */
- std::string mapKBAccel (const char *src);
+ std::string mapKBAccel (const std::string &src);
- /* Filters characters that are not on the valids_chars array from the text string
- Length is used to tell the length of text, in case it isn't NUL
- terminated (you may pass -1, if it is).
- Use the compare string member if you want to see if there was any change. */
- std::string filterText (const char* text, int length, const char* valid_chars);
-
- /* Convenience call for widgets that implement GtkEditable interface.
- This function inserts and deletes text, if needed, so you may want
- to block those signals, if you have them set. */
- void filterText (GtkEditable *editable, int pos, int length,
- const char *valid_chars);
+ /* Adds filter support to a GtkEntry. */
+ void setFilter (GtkEntry *entry, const std::string &validChars);
/* Replaces every 'mouth' by 'food' in 'str'. */
void replace (std::string &str, const char *mouth, int mouth_len, const char *food);
@@ -65,27 +56,12 @@
eg: splitString ("Office/Writer", '/') => { "Office", "Writer" } */
std::list <std::string> splitString (const std::string &str, char separator);
- /* Prints a GtkTreeModel for debugging purposes. */
- void print_model (GtkTreeModel *model, int string_col);
-
- /* To be used as a callback to sort tree views. */
- gint sort_compare_cb (GtkTreeModel *model, GtkTreeIter *a,
- GtkTreeIter *b, gpointer data);
-
- /* To be used as a callback for a GtkTreeView with toggle cells. */
- void tree_view_radio_toggle_cb (GtkCellRendererToggle *renderer,
- gchar *path_str, GtkTreeModel *model);
-
- /* Goes through all GtkTreeView columns and checks for TextCellRenderers,
- setting those columns as sortable. */
- void tree_view_set_sortable (GtkTreeView *view, int default_sort_col);
-
- /* Like gtk_tree_view_scroll_to_point(), but does smooth scroll. */
- void tree_view_smooth_scroll_to_point (GtkTreeView *view, gint x, gint y);
-
/* Converts stuff to GValues */
GValue floatToGValue (float num);
+ GdkPixbuf *loadPixbuf (const std::string &fileneme);
+
+ /* Tries to make sense out of the string, applying some stock icon to the button. */
void setStockIcon (GtkWidget *button, std::string ycp_str);
};
@@ -94,6 +70,8 @@
int ygutils_getCharsHeight (GtkWidget *widget, int chars_nb);
void ygutils_setWidgetFont (GtkWidget *widget, PangoWeight weight, double scale);
+ void ygutils_setFilter (GtkEntry *entry, const char *validChars);
+
/* Convert html to xhtml (or at least try) */
gchar *ygutils_convert_to_xhmlt_and_subst (const char *instr, const char *product);
void ygutils_setStockIcon (GtkWidget *button, const char *ycp_str);
Modified: trunk/gtk/src/YGWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.cc?rev=43216&r1…
==============================================================================
--- trunk/gtk/src/YGWidget.cc (original)
+++ trunk/gtk/src/YGWidget.cc Thu Dec 20 21:44:06 2007
@@ -14,17 +14,17 @@
/* YGWidget follows */
-YGWidget::YGWidget(YWidget *y_widget, YGWidget *parent, bool show,
+YGWidget::YGWidget(YWidget *ywidget, YWidget *yparent, bool show,
GtkType type, const char *property_name, ...)
- : m_y_widget (y_widget)
+ : m_ywidget (ywidget)
{
va_list args;
va_start (args, property_name);
- construct (y_widget, parent, show, type, property_name, args);
+ construct (ywidget, yparent, show, type, property_name, args);
va_end (args);
}
-void YGWidget::construct (YWidget *y_widget, YGWidget *parent, bool _show,
+void YGWidget::construct (YWidget *ywidget, YWidget *yparent, bool _show,
GType type, const char *property_name, va_list args)
{
m_widget = GTK_WIDGET (g_object_new_valist (type, property_name, args));
@@ -38,19 +38,16 @@
gtk_container_add (GTK_CONTAINER (m_adj_size), m_widget);
}
- y_widget->setWidgetRep ((void *) this);
- if (parent)
- y_widget->setParent (parent->m_y_widget);
-
-#ifdef IMPL_DEBUG
- fprintf (stderr, "Set YWidget %p rep to %p\n", y_widget, this);
-#endif
-
// Split by two so that with another widget it will have full border...
setBorder (DEFAULT_BORDER / 2);
-
if (_show)
show();
+
+ ywidget->setWidgetRep ((void *) this);
+ if (yparent) {
+ ywidget->setParent (yparent);
+ yparent->addChild (ywidget);
+ }
}
YGWidget::~YGWidget()
@@ -65,24 +62,14 @@
gtk_widget_show (m_widget);
}
-YGWidget *YGWidget::get (YWidget *y_widget)
+YGWidget *YGWidget::get (YWidget *ywidget)
{
- if (!y_widget || !y_widget->widgetRep()) {
-#ifdef IMPL_DEBUG
- if (y_widget)
- fprintf (stderr, "Widget '%s' (label: '%s') not supported\n",
- y_widget->widgetClass(), y_widget->debugLabel().c_str());
- else
- fprintf (stderr, "YGWidget::get() on null\n");
-#endif
- return NULL;
- }
- return (YGWidget *) (y_widget->widgetRep());
+ g_assert (ywidget->widgetRep() != NULL);
+ return (YGWidget *) ywidget->widgetRep();
}
bool YGWidget::doSetKeyboardFocus()
{
- IMPL
gtk_widget_grab_focus (GTK_WIDGET (getWidget()));
return gtk_widget_is_focus (GTK_WIDGET (getWidget()));
}
@@ -92,6 +79,26 @@
gtk_widget_set_sensitive (getWidget(), enabled);
}
+void YGWidget::doAddChild (YWidget *ychild, GtkWidget *container)
+{
+ GtkWidget *child = YGWidget::get (ychild)->getLayout();
+ gtk_container_add (GTK_CONTAINER (container), child);
+}
+
+void YGWidget::doRemoveChild (YWidget *ychild, GtkWidget *container)
+{
+ /* Note: removeChild() is generally a result of a widget being removed as it
+ will remove itself from the parent. But YGWidget deconstructor would run
+ before the YWidget one, as that's the order we have been using, so we
+ can't use it, we can't retrieve the GTK widget then. However, this is a
+ non-issue, as ~YGWidget will destroy the widget, and GTK will remove it
+ from the parent. */
+ if (!ychild->beingDestroyed()) {
+ GtkWidget *child = YGWidget::get (ychild)->getLayout();
+ gtk_container_remove (GTK_CONTAINER (container), child);
+ }
+}
+
void YGWidget::emitEvent(YEvent::EventReason reason, bool if_notify,
bool if_not_pending, bool immediate)
{
@@ -106,14 +113,14 @@
}
};
- if (!if_notify || m_y_widget->getNotify())
+ if (!if_notify || m_ywidget->notify())
{
if (!immediate)
- g_timeout_add (250, inner::dispatchEvent, new YWidgetEvent (m_y_widget, reason));
- else if (!if_not_pending || !YGUI::ui()->eventPendingFor (m_y_widget))
+ g_timeout_add (250, inner::dispatchEvent, new YWidgetEvent (m_ywidget, reason));
+ else if (!if_not_pending || !YGUI::ui()->eventPendingFor (m_ywidget))
{
if (immediate)
- YGUI::ui()->sendEvent (new YWidgetEvent (m_y_widget, reason));
+ YGUI::ui()->sendEvent (new YWidgetEvent (m_ywidget, reason));
}
}
}
@@ -143,59 +150,18 @@
void YGWidget::sync_stretchable (YWidget *child)
{
IMPL
- YWidget *parent = m_y_widget->yParent();
+ YWidget *parent = m_ywidget->parent();
if (parent)
- // tell parent to sync too!
- YGWidget::get (parent)->sync_stretchable (m_y_widget);
-}
-
-// JEEZ. WHEN the hell will yast-ui code fix their damn code.
-#if 1
-/* Checks everywhere in a container to see if there are children (so
- he is completely initialized) so that we may ask him for stretchable()
- because some YContainerWidgets crash when they don't have children. */
-#include "YSplit.h"
-static bool safe_stretchable (YWidget *widget)
-{
- YContainerWidget *container = dynamic_cast <YContainerWidget *> (widget);
- if (container) {
- YSplit *split = dynamic_cast <YSplit *> (widget);
- // in the case of YSplit its safe to ask for stretchability with no kids
- if (split) {
- if (!split->hasChildren())
- return true;
- }
- else
- if (!container->hasChildren())
- return false;
-
- for (int i = 0; i < container->numChildren(); i++)
- if (!safe_stretchable (container->child (i)))
- return false;
- }
- return true;
-}
-#else
-static bool safe_stretchable (YWidget *widget)
-{
- return true;
-}
-#endif
-
-bool YGWidget::isStretchable (YUIDimension dim)
-{
- if (safe_stretchable (m_y_widget))
- return m_y_widget->stretchable (dim);
- return false;
+ YGWidget::get (parent)->sync_stretchable (m_ywidget);
}
/* YGLabeledWidget follows */
-YGLabeledWidget::YGLabeledWidget (YWidget *y_widget, YGWidget *parent,
- YCPString label_text, YUIDimension label_ori,
+YGLabeledWidget::YGLabeledWidget (YWidget *ywidget, YWidget *parent,
+ const std::string &label_text, YUIDimension label_ori,
bool show, GType type,
const char *property_name, ...)
- : YGWidget (y_widget, parent, show,
+ : YGWidget (ywidget, parent, show,
label_ori == YD_VERT ? GTK_TYPE_VBOX : GTK_TYPE_HBOX,
"spacing", LABEL_WIDGET_SPACING, NULL)
{
@@ -237,12 +203,11 @@
gtk_label_set_mnemonic_widget (GTK_LABEL (m_label), widget);
}
-void YGLabeledWidget::doSetLabel (const YCPString &label)
+void YGLabeledWidget::doSetLabel (const std::string &label)
{
- string str = YGUtils::mapKBAccel (label->value_cstr());
- if (str.empty()) {
+ string str = YGUtils::mapKBAccel (label);
+ if (str.empty())
gtk_widget_hide (m_label);
- }
else {
gtk_widget_show (m_label);
@@ -264,11 +229,11 @@
/* YGScrolledWidget follows */
#define MAX_SCROLL_WIDTH 120
-YGScrolledWidget::YGScrolledWidget (YWidget *y_widget, YGWidget *parent,
+YGScrolledWidget::YGScrolledWidget (YWidget *ywidget, YWidget *parent,
bool show, GType type,
const char *property_name, ...)
- : YGLabeledWidget (y_widget, parent, YCPString (""), YD_VERT, show,
- YGTK_TYPE_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, NULL)
+ : YGLabeledWidget (ywidget, parent, string(), YD_VERT, show,
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, NULL)
{
va_list args;
va_start (args, property_name);
@@ -278,12 +243,12 @@
setLabelVisible (false);
}
-YGScrolledWidget::YGScrolledWidget (YWidget *y_widget, YGWidget *parent,
- YCPString label_text, YUIDimension label_ori,
+YGScrolledWidget::YGScrolledWidget (YWidget *ywidget, YWidget *parent,
+ const std::string &label_text, YUIDimension label_ori,
bool show, GType type,
const char *property_name, ...)
- : YGLabeledWidget (y_widget, parent, label_text, label_ori, show,
- YGTK_TYPE_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, NULL)
+ : YGLabeledWidget (ywidget, parent, label_text, label_ori, show,
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, NULL)
{
va_list args;
va_start (args, property_name);
@@ -306,7 +271,8 @@
{
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (YGLabeledWidget::getWidget()),
hpolicy, vpolicy);
- ygtk_scrolled_window_set_auto_policy (YGTK_SCROLLED_WINDOW (YGLabeledWidget::getWidget()),
+ ygtk_tuned_scrolled_window_set_auto_policy (
+ YGTK_TUNED_SCROLLED_WINDOW (YGLabeledWidget::getWidget()),
hpolicy == GTK_POLICY_AUTOMATIC ? MAX_SCROLL_WIDTH : 0, 0);
}
Modified: trunk/gtk/src/YGWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.h?rev=43216&r1=…
==============================================================================
--- trunk/gtk/src/YGWidget.h (original)
+++ trunk/gtk/src/YGWidget.h Thu Dec 20 21:44:06 2007
@@ -13,29 +13,29 @@
class YGWidget
{
public:
- YGWidget(YWidget *y_widget, YGWidget *parent, bool show,
+ YGWidget(YWidget *ywidget, YWidget *yparent, bool show,
GType type, const char *property_name, ...);
virtual ~YGWidget();
virtual GtkWidget *getWidget() { return m_widget; }
- const char *getWidgetName() const
- { return const_cast <YWidget *> (m_y_widget)->widgetClass(); }
- // YWidget::debugLabel() sucks for most widgets -- let's allow it to be overload
- virtual string getDebugLabel() const
- { // container debug labels are worse than useless
- if (dynamic_cast <YContainerWidget *> (m_y_widget) == NULL)
- return const_cast <YWidget *> (m_y_widget)->debugLabel(); return string(); }
- void show();
-
// containers should use this call rather than getWidget()
GtkWidget *getLayout() { return m_adj_size; }
// Get the YGWidget associated with a YWidget
static YGWidget *get (YWidget *y_widget);
+ // debug
+ const char *getWidgetName() const { return m_ywidget->widgetClass(); }
+ virtual string getDebugLabel() const // let YWidget::debugLabel() be overloaded
+ { // container debug labels are worse than useless
+ if (m_ywidget->hasChildren()) return string();
+ return m_ywidget->debugLabel(); }
+
// for YWidget
virtual bool doSetKeyboardFocus();
virtual void doSetEnabling (bool enabled);
+ virtual void doAddChild (YWidget *child, GtkWidget *container);
+ virtual void doRemoveChild (YWidget *child, GtkWidget *container);
// Event handling
void emitEvent(YEvent::EventReason reason, bool if_notify = true,
@@ -50,16 +50,14 @@
// for a container), call this function to make sure it is honored.
virtual void sync_stretchable (YWidget *child = 0);
- // should be used instead of YWidget::stretchable() as this has some safeguards
- // against crashes that some YContainerWidgets lead to
- bool isStretchable (YUIDimension dim);
-
protected:
+ void show();
+
GtkWidget *m_widget; // associated GtkWidget -- use getWidget()
- YWidget *m_y_widget; // associated YWidget
GtkWidget *m_adj_size; // installed on m_widget, allows better size constrains
+ YWidget *m_ywidget; // associated YWidget
- void construct (YWidget *y_widget, YGWidget *parent,
+ void construct (YWidget *ywidget, YWidget *yparent,
bool show, GType type,
const char *property_name, va_list args);
};
@@ -69,29 +67,34 @@
* methods and the (multiply inherited) YGWidget base implementation
* for GTK+.
*/
-#define YGWIDGET_IMPL_COMMON \
- virtual bool setKeyboardFocus() \
- { return doSetKeyboardFocus(); } \
- virtual void setEnabling (bool enabled) \
- { doSetEnabling (enabled); } \
- virtual long nicesize (YUIDimension dim) { return 0; } \
- virtual void moveChild (YWidget *child, long x, long y) {} \
- virtual void setSize (long width, long height) {}
+#define YGWIDGET_IMPL_COMMON \
+ virtual bool setKeyboardFocus() \
+ { return doSetKeyboardFocus(); } \
+ virtual void setEnabling (bool enabled) \
+ { doSetEnabling (enabled); } \
+ virtual int preferredWidth() { return 0; } \
+ virtual int preferredHeight() { return 0; } \
+ virtual void moveChild (YWidget *child, int x, int y) {} \
+ virtual void setSize (int width, int height) {}
+
+#define YGWIDGET_IMPL_USE_BOLD(ParentClass) \
+ virtual void setUseBoldFont (bool useBold) { \
+ PangoWeight weight = useBold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL; \
+ YGUtils::setWidgetFont (getWidget(), weight, PANGO_SCALE_MEDIUM); \
+ ParentClass::setUseBoldFont (useBold); \
+ }
// for containers
-// We can't use childAdded, since some classes don't want this called
-// for some children.
#define YGWIDGET_IMPL_CHILD_ADDED(container) \
virtual void addChild (YWidget *ychild) { \
- YContainerWidget::addChild (ychild); \
- GtkWidget *child = YGWidget::get (ychild)->getLayout(); \
- gtk_container_add (GTK_CONTAINER (container), child); \
- sync_stretchable(); \
+ YWidget::addChild (ychild); \
+ doAddChild (ychild, container); \
+ sync_stretchable (ychild); \
}
-#define YGWIDGET_IMPL_CHILD_REMOVED(container) \
- virtual void childRemoved (YWidget *ychild) { \
- GtkWidget *child = YGWidget::get (ychild)->getLayout(); \
- gtk_container_remove (GTK_CONTAINER (container), child); \
+#define YGWIDGET_IMPL_CHILD_REMOVED(container) \
+ virtual void removeChild (YWidget *ychild) { \
+ YWidget::removeChild (ychild); \
+ doRemoveChild (ychild, container); \
}
/* This is a convenience class that allows for a label next to the
@@ -100,8 +103,8 @@
class YGLabeledWidget : public YGWidget
{
public:
- YGLabeledWidget(YWidget *y_widget, YGWidget *parent,
- YCPString label_text, YUIDimension label_ori,
+ YGLabeledWidget(YWidget *ywidget, YWidget *yparent,
+ const std::string &label_text, YUIDimension label_ori,
bool show, GType type, const char *property_name, ...);
virtual ~YGLabeledWidget () {}
@@ -109,7 +112,7 @@
void setLabelVisible(bool show);
void setBuddy (GtkWidget *widget);
- virtual void doSetLabel (const YCPString &label);
+ virtual void doSetLabel (const std::string &label);
YUIDimension orientation() { return m_orientation; }
GtkWidget *getLabelWidget() { return m_label; }
@@ -120,7 +123,7 @@
};
#define YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(ParentClass) \
- virtual void setLabel (const YCPString &label) { \
+ virtual void setLabel (const std::string &label) { \
IMPL \
doSetLabel (label); \
ParentClass::setLabel (label); \
@@ -130,11 +133,11 @@
class YGScrolledWidget : public YGLabeledWidget
{
public:
- YGScrolledWidget(YWidget *y_widget, YGWidget *parent,
+ YGScrolledWidget(YWidget *ywidget, YWidget *yparent,
bool show, GType type, const char *property_name, ...);
// if you want a label, use:
- YGScrolledWidget(YWidget *y_widget, YGWidget *parent,
- YCPString label_text, YUIDimension label_ori,
+ YGScrolledWidget(YWidget *ywidget, YWidget *yparent,
+ const std::string &label_text, YUIDimension label_ori,
bool show, GType type, const char *property_name, ...);
virtual ~YGScrolledWidget () {}
@@ -149,3 +152,4 @@
};
#endif /*YGWIDGET_H*/
+
Modified: trunk/gtk/src/YGWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWizard.cc?rev=43216&r1…
==============================================================================
--- trunk/gtk/src/YGWizard.cc (original)
+++ trunk/gtk/src/YGWizard.cc Thu Dec 20 21:44:06 2007
@@ -10,10 +10,21 @@
#include "ygtkwizard.h"
#include "YWizard.h"
#include "YPushButton.h"
+#include "YAlignment.h"
+#include "YReplacePoint.h"
+#include "YGDialog.h"
+
+
+// FIXME: wizard events need to be ported
+// We'll probably want to also make YGtkWizard buttons actual YGPushButtons...
+// (let's just create them and pass button->getWidget() to the wizard...)
+// (or let's just improve on the wrapper and id.)
+
class YGWizard : public YWizard, public YGWidget
{
bool m_verboseCommands;
+ YReplacePoint *m_replacePoint;
/* YCP requires us to allow people to use YPushButton API on the wizard buttons.
Wizard already has handlers for them; this seems like bad design.
@@ -27,41 +38,41 @@
struct YGWButton : public YPushButton {
/* Thin class; just changes the associated button label and keeps track
of id change. */
- YGWButton (GtkWidget *widget, const YCPString &label, const YCPValue &id)
- : YPushButton (YWidgetOpt(), label)
- { m_widget = widget; setId (id); setLabel (label); }
+ YGWButton (YWidget *parent, GtkWidget *widget, const std::string &label)
+ : YPushButton (parent, label)
+ { setWidgetRep (NULL); m_widget = widget; setLabel (label); }
- void setLabel (const YCPString &label) {
- string str = YGUtils::mapKBAccel (label->value_cstr());
+ void setLabel (const string &label) {
+ string str = YGUtils::mapKBAccel (label.c_str());
gtk_button_set_label (GTK_BUTTON (m_widget), str.c_str());
str.empty() ? gtk_widget_hide (m_widget) : gtk_widget_show (m_widget);
YGUtils::setStockIcon (m_widget, str);
YPushButton::setLabel (label);
}
- long nicesize (YUIDimension dim) { return 0; }
- void setEnabling (bool enable) {
+ void setEnabled (bool enable) {
gtk_widget_set_sensitive (m_widget, enable);
- YWidget::setEnabling (enable);
+ YWidget::setEnabled (enable);
}
+ int preferredWidth() { return 0; }
+ int preferredHeight() { return 0; }
+ void setSize (int w, int h) {}
+
private:
GtkWidget *m_widget;
};
- YGWButton *m_back_button, *m_abort_button, *m_next_button;
+ YGWButton *m_back_button, *m_abort_button, *m_next_button, *m_notes_button;
// release notes button would be a little more hassle to support; yast-qt
// doesn't support it too anyway.
public:
- YGWizard (const YWidgetOpt &opt, YGWidget *parent,
- const YCPValue &backButtonId, const YCPString &backButtonLabel,
- const YCPValue &abortButtonId, const YCPString &abortButtonLabel,
- const YCPValue &nextButtonId, const YCPString &nextButtonLabel)
- : YWizard (opt, backButtonId, backButtonLabel,
- abortButtonId, abortButtonLabel,
- nextButtonId, nextButtonLabel),
- YGWidget (this, parent, true, YGTK_TYPE_WIZARD, NULL)
+ YGWizard (YWidget *parent, const string &backButtonLabel,
+ const string &abortButtonLabel, const string &nextButtonLabel,
+ YWizardMode wizardMode)
+ : YWizard (NULL, backButtonLabel, abortButtonLabel, nextButtonLabel, wizardMode)
+ , YGWidget (this, parent, true, YGTK_TYPE_WIZARD, NULL)
{
IMPL
setBorder (0);
@@ -69,59 +80,39 @@
//** Application area
{
- // We set a YReplacePoint as child with a certain id and it will then be
- // replaced by the actual content. We put a YEmpty on it because it would
- // crash otherwise (stretchable() functions should really check for
- // hasChildren() first!).
-
- YWidgetOpt opt, stretchOpt;
- stretchOpt.isHStretchable.setValue( true );
- stretchOpt.isVStretchable.setValue( true );
-
- YWidget *align, *rp, *empty;
- align = YGUI::ui()->createAlignment (this, stretchOpt,
- YAlignCenter, YAlignCenter);
- rp = YGUI::ui()->createReplacePoint (align, opt);
- rp->setId (YCPSymbol (YWizardContentsReplacePointID));
- empty = YGUI::ui()->createEmpty (rp, opt);
-
- ((YContainerWidget *) align)->addChild (rp);
- ((YContainerWidget *) rp)->addChild (empty);
- this->addChild (align);
+ YAlignment *align = YUI::widgetFactory()->createAlignment (this,
+ YAlignCenter, YAlignCenter);
+ align->setStretchable (YD_HORIZ, true);
+ align->setStretchable (YD_VERT, true);
+
+ m_replacePoint = YUI::widgetFactory()->createReplacePoint ((YWidget *) align);
+ YUI::widgetFactory()->createEmpty ((YWidget *) m_replacePoint);
+ m_replacePoint->showChild();
}
- YGtkWizard *ygtk_wizard = YGTK_WIZARD (getWidget());
-
//** Steps/tree pane
- bool steps_enabled = opt.stepsEnabled.value();
- bool tree_enabled = opt.treeEnabled.value();
+ bool steps_enabled = wizardMode == YWizardMode_Steps;
+ bool tree_enabled = wizardMode == YWizardMode_Tree;
if (steps_enabled && tree_enabled) {
y2error ("YGWizard doesn't support both steps and tree enabled at the "
"same time.\nDisabling the steps...");
steps_enabled = false;
}
if (steps_enabled)
- ygtk_wizard_enable_steps (ygtk_wizard);
+ ygtk_wizard_enable_steps (getWizard());
if (tree_enabled)
- ygtk_wizard_enable_tree (ygtk_wizard);
+ ygtk_wizard_enable_tree (getWizard());
//** Setting the bottom buttons
- m_back_button = new YGWButton (ygtk_wizard->m_back_button, backButtonLabel,
- backButtonId);
- m_abort_button = new YGWButton (ygtk_wizard->m_abort_button, abortButtonLabel,
- abortButtonId);
- m_next_button = new YGWButton (ygtk_wizard->m_next_button, nextButtonLabel,
- nextButtonId);
- YContainerWidget::addChild (m_back_button);
- YContainerWidget::addChild (m_abort_button);
- YContainerWidget::addChild (m_next_button);
-
- ygtk_wizard_set_back_button_id (ygtk_wizard, new YCPValue (backButtonId),
- delete_data_cb);
- ygtk_wizard_set_abort_button_id (ygtk_wizard, new YCPValue (abortButtonId),
- delete_data_cb);
- ygtk_wizard_set_next_button_id (ygtk_wizard, new YCPValue (nextButtonId),
- delete_data_cb);
+ m_back_button = new YGWButton (this, getWizard()->m_back_button, backButtonLabel);
+ m_abort_button = new YGWButton (this, getWizard()->m_abort_button, abortButtonLabel);
+ m_next_button = new YGWButton (this, getWizard()->m_next_button, nextButtonLabel);
+ m_notes_button = new YGWButton (this, getWizard()->m_release_notes_button, string());
+
+ ygtk_wizard_set_back_button_ptr_id (getWizard(), (gpointer) m_back_button);
+ ygtk_wizard_set_next_button_ptr_id (getWizard(), (gpointer) m_next_button);
+ ygtk_wizard_set_abort_button_ptr_id (getWizard(), (gpointer) m_abort_button);
+ ygtk_wizard_set_release_notes_button_ptr_id (getWizard(), (gpointer) m_notes_button);
//** All event are sent through this signal together with an id
g_signal_connect (G_OBJECT (getWidget()), "action-triggered",
@@ -133,240 +124,174 @@
// m_back/abort/next_button are added as children and will be freed by ~YContainerWidget
}
- /* The purpose of this function is to do some sanity checks, besides
- the simple test "cmd->name() == func".
- args_type is a reverse hexadecimal number where
- any = 0, string = 1, boolean = 2. */
- static bool isCommand (const YCPTerm &cmd, const char *func,
- guint args_nb, guint args_type)
- {
- if (cmd->name() == func) {
- if ((unsigned) cmd->size() != args_nb) {
- y2error ("YGWizard: expected %d arguments for the '%s' command. %d given.",
- args_nb, func, cmd->size());
- return false;
- }
-
- guint i, t;
- for (i = 0, t = args_type; i < args_nb; i++, t >>= 4)
- switch (t % 0x4) {
- case 0x1:
- if (!cmd->value(i)->isString()) {
- y2error ("YGWizard: expected string as the %d argument for "
- "the '%s' command.", i+1, func);
- return false;
- }
- break;
- case 0x2:
- if (!cmd->value(i)->isBoolean()) {
- y2error ("YGWizard: expected boolean as the %d argument for "
- "the '%s' command.", i+1, func);
- return false;
- }
- break;
- }
- return true;
- }
- return false;
+ inline YGtkWizard *getWizard()
+ { return YGTK_WIZARD (getWidget()); }
+
+ virtual YReplacePoint *contentsReplacePoint() const
+ { return m_replacePoint; }
+
+ virtual YPushButton *backButton() const
+ { return m_back_button; }
+ virtual YPushButton *abortButton() const
+ { return m_abort_button; }
+ virtual YPushButton *nextButton() const
+ { return m_next_button; }
+
+ virtual void setButtonLabel (YPushButton *button, const string &label)
+ {
+ button->setLabel (label);
}
-#define getStdStringArg(cmd, arg) (cmd->value(arg)->asString()->value())
-#define getCStringArg(cmd, arg) (cmd->value(arg)->asString()->value_cstr())
-#define getBoolArg(cmd, arg) (cmd->value(arg)->asBoolean()->value())
-#define getAnyArg(cmd, arg) (cmd->value(arg))
+ virtual void setHelpText (const string &text)
+ {
+ ygtk_wizard_set_help_text (getWizard(), text.c_str());
+ }
- YCPValue command (const YCPTerm &cmd)
+ virtual void setDialogIcon (const string &icon)
{
- IMPL
- if (m_verboseCommands)
- y2milestone ("Processing wizard command: %s\n", cmd->name().c_str());
+ if (!ygtk_wizard_set_header_icon (getWizard(), YGDialog::currentWindow(),
+ icon.c_str()))
+ y2warning ("YGWizard: could not load image: %s", icon.c_str());
+ }
- YGtkWizard *wizard = YGTK_WIZARD (getWidget());
- if (isCommand (cmd, "SetHelpText", 1, 0x1))
- ygtk_wizard_set_help_text (wizard, getCStringArg (cmd, 0));
-
- else if (isCommand (cmd, "AddTreeItem", 3, 0x111)) {
- if (!ygtk_wizard_add_tree_item (wizard, getCStringArg (cmd, 0),
- getCStringArg (cmd, 1), getCStringArg (cmd, 2))) {
- y2error ("YGWizard: there is no tree item with id '%s'",
- getCStringArg (cmd, 0));
- return YCPBoolean (false);
- }
- }
- else if (isCommand (cmd, "DeleteTreeItems", 0, 0))
- ygtk_wizard_clear_tree (wizard);
- else if (isCommand (cmd, "SelectTreeItem", 1, 0x1)) {
- if (!ygtk_wizard_select_tree_item (wizard, getCStringArg (cmd, 0))) {
- y2error ("YGWizard: there is no tree item with id '%s'",
- getCStringArg (cmd, 0));
- return YCPBoolean (false);
- }
- }
+ virtual void setDialogHeading (const string &heading)
+ {
+ ygtk_wizard_set_header_text (getWizard(), YGDialog::currentWindow(),
+ heading.c_str());
+ }
- else if (isCommand (cmd, "SetDialogHeading", 1, 0x1))
- ygtk_wizard_set_header_text (wizard, YGUI::ui()->currentWindow(),
- getCStringArg (cmd, 0));
- else if (isCommand (cmd, "SetDialogIcon", 1, 0x1)) {
- if (!ygtk_wizard_set_header_icon (wizard,
- YGUI::ui()->currentWindow(), getCStringArg (cmd, 0))) {
- y2warning ("YGWizard: could not load image: %s", getCStringArg (cmd, 0));
-// return YCPBoolean (false); - installer relies on this succeeding
- }
- }
+ virtual void addStep (const string &text, const string &id)
+ {
+ ygtk_wizard_add_step (getWizard(), text.c_str(), id.c_str());
+ }
- else if (isCommand (cmd, "SetAbortButtonLabel", 1, 0x1) ||
- isCommand (cmd, "SetCancelButtonLabel", 1, 0x1)) {
- string str = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
- ygtk_wizard_set_abort_button_label (wizard, str.c_str());
- }
- else if (isCommand (cmd, "SetBackButtonLabel", 1, 0x1)) {
- string str = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
- ygtk_wizard_set_back_button_label (wizard, str.c_str());
- }
- else if (isCommand (cmd, "SetNextButtonLabel", 1, 0x1) ||
- isCommand (cmd, "SetAcceptButtonLabel", 1, 0x1)) {
- string str = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
- ygtk_wizard_set_next_button_label (wizard, str.c_str());
- }
+ virtual void addStepHeading (const string &text)
+ {
+ ygtk_wizard_add_step_header (getWizard(), text.c_str());
+ }
- else if (isCommand (cmd, "SetAbortButtonID", 1, 0x0)) {
- YCPValue *id = new YCPValue (getAnyArg (cmd, 0));
- ygtk_wizard_set_abort_button_id (wizard, id, delete_data_cb);
- m_abort_button->setId (*id);
- }
- else if (isCommand (cmd, "SetBackButtonID", 1, 0x0)) {
- YCPValue *id = new YCPValue (getAnyArg (cmd, 0));
- ygtk_wizard_set_back_button_id (wizard, id, delete_data_cb);
- m_back_button->setId (*id);
- }
- else if (isCommand (cmd, "SetNextButtonID", 1, 0x0)) {
- YCPValue *id = new YCPValue (getAnyArg (cmd, 0));
- ygtk_wizard_set_next_button_id (wizard, id, delete_data_cb);
- m_next_button->setId (*id);
- }
+ virtual void deleteSteps()
+ {
+ ygtk_wizard_clear_steps (getWizard());
+ }
- else if (isCommand (cmd, "EnableAbortButton", 1, 0x2))
- ygtk_wizard_enable_abort_button (wizard, getBoolArg (cmd, 0));
- else if (isCommand (cmd, "EnableBackButton", 1, 0x2))
- ygtk_wizard_enable_back_button (wizard, getBoolArg (cmd, 0));
- else if (isCommand (cmd, "EnableNextButton", 1, 0x2))
- ygtk_wizard_enable_next_button (wizard, getBoolArg (cmd, 0));
-
- else if (isCommand (cmd, "ProtectNextButton", 1, 0x2))
- ygtk_wizard_protect_next_button (wizard, getBoolArg (cmd, 0));
-
- else if (isCommand (cmd, "SetFocusToNextButton", 0, 0))
- ygtk_wizard_focus_next_button (wizard);
- else if (isCommand (cmd, "SetFocusToBackButton", 0, 0))
- ygtk_wizard_focus_back_button (wizard);
-
- else if (isCommand (cmd, "AddMenu", 2, 0x11)) {
- string str = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
- ygtk_wizard_add_menu (wizard, str.c_str(), getCStringArg (cmd, 1));
- }
- else if (isCommand (cmd, "AddMenuEntry", 3, 0x111)) {
- string str = YGUtils::mapKBAccel(getCStringArg (cmd, 1));
- if (!ygtk_wizard_add_menu_entry (wizard, getCStringArg (cmd, 0),
- str.c_str(), getCStringArg (cmd, 2))) {
- y2error ("YGWizard: there is no menu item with id '%s'",
- getCStringArg (cmd, 0));
- return YCPBoolean (false);
- }
- }
- else if (isCommand (cmd, "AddSubMenu", 3, 0x111)) {
- string str = YGUtils::mapKBAccel(getCStringArg (cmd, 1));
- if (!ygtk_wizard_add_sub_menu (wizard, getCStringArg (cmd, 0),
- str.c_str(), getCStringArg (cmd, 2))) {
- y2error ("YGWizard: there is no menu item with id '%s'",
- getCStringArg (cmd, 0));
- return YCPBoolean (false);
- }
- }
- else if (isCommand (cmd, "AddMenuSeparator", 3, 0x111)) {
- if (!ygtk_wizard_add_menu_separator (wizard, getCStringArg (cmd, 0))) {
- y2error ("YGWizard: there is no menu item with id '%s'",
- getCStringArg (cmd, 0));
- return YCPBoolean (false);
- }
- }
+ virtual void setCurrentStep (const string &id)
+ {
+ if (!ygtk_wizard_set_current_step (getWizard(), id.c_str()))
+ y2error ("YGWizard: there is no step with id %s.", id.c_str());
+ }
- else if (isCommand (cmd, "SetVerboseCommands", 1, 0x2))
- m_verboseCommands = getBoolArg (cmd, 0);
- else if (isCommand (cmd, "Ping", 0, 0))
- y2debug ("YGWizard is active");
-
- else if (isCommand (cmd, "AddStepHeading", 1, 0x1))
- ygtk_wizard_add_step_header (wizard, getCStringArg (cmd, 0));
- else if (isCommand (cmd, "AddStep", 2, 0x11))
- ygtk_wizard_add_step (wizard, getCStringArg (cmd, 0), getCStringArg (cmd, 1));
- else if (isCommand (cmd, "SetCurrentStep", 1, 0x1)) {
- if (!ygtk_wizard_set_current_step (wizard, getCStringArg (cmd, 0))) {
- y2error ("YGWizard: there is no step with id %s.", getCStringArg (cmd, 0));
- return YCPBoolean (false);
- }
- }
- else if (isCommand (cmd, "UpdateSteps", 0, 0))
- ;
- else if (isCommand (cmd, "DeleteSteps", 0, 0))
- ygtk_wizard_clear_steps (wizard);
-
- else if (isCommand (cmd, "ShowReleaseNotesButton", 2, 0x01)) {
- string label = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
- ygtk_wizard_set_release_notes_button_label (wizard, label.c_str(),
- new YCPValue (getAnyArg (cmd, 1)), delete_data_cb);
- }
- else if (isCommand (cmd, "HideReleaseNotesButton", 0, 0))
- ygtk_wizard_show_release_notes_button (wizard, FALSE);
+ virtual void updateSteps()
+ {}
- else if (isCommand (cmd, "RetranslateInternalButtons", 0, 0))
- ; // we don't need this as we don't use switch buttons
+ virtual void addTreeItem (const string &parentID, const string &text,
+ const string &id)
+ {
+ if (!ygtk_wizard_add_tree_item (getWizard(), parentID.c_str(),
+ text.c_str(), id.c_str()))
+ y2error ("YGWizard: there is no tree item with id '%s'",
+ parentID.c_str());
+ }
- else {
- y2error ("Unsupported wizard command (or invalid arguments): %s\n",
- cmd->name().c_str());
- return YCPBoolean (false);
- }
- return YCPBoolean (true);
+ virtual void selectTreeItem (const string &id)
+ {
+ if (!ygtk_wizard_select_tree_item (getWizard(), id.c_str()))
+ y2error ("YGWizard: there is no tree item with id '%s'", id.c_str());
}
- virtual YCPString currentTreeSelection()
+ virtual string currentTreeSelection()
{
- YGtkWizard *wizard = YGTK_WIZARD (getWidget());
- const char *selected = ygtk_wizard_get_tree_selection (wizard);
+ const char *selected = ygtk_wizard_get_tree_selection (getWizard());
if (selected)
- return YCPString (selected);
- return YCPString ("");
+ return selected;
+ return string();
+ }
+
+ virtual void deleteTreeItems()
+ {
+ ygtk_wizard_clear_tree (getWizard());
+ }
+
+ virtual void addMenu (const string &text, const string &id)
+ {
+ string str = YGUtils::mapKBAccel (text);
+ ygtk_wizard_add_menu (getWizard(), str.c_str(), id.c_str());
+ }
+
+ virtual void addSubMenu (const string &parentID, const string &text,
+ const string &id)
+ {
+ string str = YGUtils::mapKBAccel(text);
+ if (!ygtk_wizard_add_sub_menu (getWizard(), parentID.c_str(), str.c_str(),
+ id.c_str()))
+ y2error ("YGWizard: there is no menu item with id '%s'",
+ parentID.c_str());
+ }
+
+ virtual void addMenuEntry (const string &parentID, const string &text,
+ const string &id)
+ {
+ string str = YGUtils::mapKBAccel (text);
+ if (!ygtk_wizard_add_menu_entry (getWizard(), parentID.c_str(),
+ str.c_str(), id.c_str()))
+ y2error ("YGWizard: there is no menu item with id '%s'",
+ parentID.c_str());
}
+ virtual void addMenuSeparator (const string & parentID)
+ {
+ if (!ygtk_wizard_add_menu_separator (getWizard(), parentID.c_str()))
+ y2error ("YGWizard: there is no menu item with id '%s'",
+ parentID.c_str());
+ }
+
+ virtual void deleteMenus()
+ {
+ ygtk_wizard_clear_menu (getWizard());
+ }
+
+ virtual void showReleaseNotesButton (const string &label, const string &id)
+ {
+ string str = YGUtils::mapKBAccel (label.c_str());
+ ygtk_wizard_set_release_notes_button_label (getWizard(), str.c_str());
+ ygtk_wizard_set_release_notes_button_str_id (getWizard(), id.c_str());
+ }
+
+ virtual void hideReleaseNotesButton()
+ {
+ ygtk_wizard_show_release_notes_button (getWizard(), FALSE);
+ }
+
+ virtual void retranslateInternalButtons()
+ {}
+
static void action_triggered_cb (YGtkWizard *wizard, gpointer id,
gint id_type, YGWizard *pThis)
{
IMPL
- if ((GType) id_type == G_TYPE_STRING) {
- YCPString _id ((char *) id);
- YGUI::ui()->sendEvent (new YMenuEvent (YCPValue (_id)));
- }
+ if ((GType) id_type == G_TYPE_STRING)
+ YGUI::ui()->sendEvent (new YMenuEvent ((char *) id));
else
- YGUI::ui()->sendEvent (new YMenuEvent (*((YCPValue *) id)));
+ YGUI::ui()->sendEvent (new YWidgetEvent ((YWidget *) id, YEvent::Activated));
}
- static void delete_data_cb (gpointer data)
- { delete (YCPValue*) data; }
-
+ virtual void doAddChild (YWidget *ychild, GtkWidget *container)
+ {
+ if (ychild->widgetRep())
+ // don't actually add the button wrappers
+ YGWidget::doAddChild (ychild, container);
+ }
YGWIDGET_IMPL_COMMON
YGWIDGET_IMPL_CHILD_ADDED (getWidget())
YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
};
-YWidget *
-YGUI::createWizard (YWidget *parent, YWidgetOpt &opt,
- const YCPValue &backButtonId, const YCPString &backButtonLabel,
- const YCPValue &abortButtonId, const YCPString &abortButtonLabel,
- const YCPValue &nextButtonId, const YCPString &nextButtonLabel)
+YWizard *YGOptionalWidgetFactory::createWizard (YWidget *parent,
+ const string &backButtonLabel, const string &abortButtonLabel,
+ const string &nextButtonLabel, YWizardMode wizardMode)
{
- return new YGWizard (opt, YGWidget::get (parent),
- backButtonId, backButtonLabel,
- abortButtonId, abortButtonLabel,
- nextButtonId, nextButtonLabel);
+ return new YGWizard (parent, backButtonLabel, abortButtonLabel, nextButtonLabel,
+ wizardMode);
}
+
Modified: trunk/gtk/src/ygtkfieldentry.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfieldentry.c?rev=432…
==============================================================================
--- trunk/gtk/src/ygtkfieldentry.c (original)
+++ trunk/gtk/src/ygtkfieldentry.c Thu Dec 20 21:44:06 2007
@@ -10,79 +10,11 @@
#include <gtk/gtk.h>
#include <string.h>
-//** YGtkFilterEntry
-
-static void ygtk_filter_entry_editable_init (GtkEditableClass *iface);
-
-G_DEFINE_TYPE_WITH_CODE (YGtkFilterEntry, ygtk_filter_entry, GTK_TYPE_ENTRY,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, ygtk_filter_entry_editable_init))
-
-static void ygtk_filter_entry_init (YGtkFilterEntry *entry)
-{
-}
-
-static void ygtk_filter_entry_insert_text (GtkEditable *editable, const gchar *new_text,
- gint new_text_length, gint *pos)
-{
- const gchar *valid_chars = YGTK_FILTER_ENTRY (editable)->valid_chars;
- if (valid_chars) {
- const gchar *i, *j;
- for (i = new_text; *i; i++) {
- for (j = valid_chars; *j; j++) {
- if (*i == *j)
- break;
- }
- if (!*j) {
- // not valid text
- gdk_beep();
- return;
- }
- }
- }
-
- GtkEditableClass *parent_editable_iface = g_type_interface_peek
- (ygtk_filter_entry_parent_class, GTK_TYPE_EDITABLE);
- parent_editable_iface->insert_text (editable, new_text, new_text_length, pos);
-}
-
-static void ygtk_filter_entry_destroy (GtkObject *object)
-{
- YGtkFilterEntry *entry = YGTK_FILTER_ENTRY (object);
- if (entry->valid_chars)
- g_free (entry->valid_chars);
- entry->valid_chars = NULL;
-
- GTK_OBJECT_CLASS (ygtk_filter_entry_parent_class)->destroy (object);
-}
-
-GtkWidget *ygtk_filter_entry_new (void)
-{
- return g_object_new (YGTK_TYPE_FILTER_ENTRY, NULL);
-}
-
-void ygtk_filter_entry_set_valid_chars (YGtkFilterEntry *entry, const gchar *valid_chars)
-{
- if (entry->valid_chars)
- g_free (entry->valid_chars);
- entry->valid_chars = g_strdup (valid_chars);
-}
-
-static void ygtk_filter_entry_class_init (YGtkFilterEntryClass *klass)
-{
- ygtk_filter_entry_parent_class = g_type_class_peek_parent (klass);
-
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
- gtkobject_class->destroy = ygtk_filter_entry_destroy;
-}
-
-static void ygtk_filter_entry_editable_init (GtkEditableClass *iface)
-{
- iface->insert_text = ygtk_filter_entry_insert_text;
-}
+void ygutils_setFilter (GtkEntry *entry, const char *validChars);
+static guint filter_entry_signal = 0;
//** YGtkFieldEntry
-static guint filter_entry_signal;
G_DEFINE_TYPE (YGtkFieldEntry, ygtk_field_entry, GTK_TYPE_HBOX)
static void ygtk_field_entry_init (YGtkFieldEntry *entry)
@@ -90,14 +22,13 @@
gtk_box_set_spacing (GTK_BOX (entry), 4);
}
-static YGtkFilterEntry *ygtk_field_entry_focus_next_entry (YGtkFieldEntry *fields,
- YGtkFilterEntry *current_entry,
- gint side)
+static GtkEntry *ygtk_field_entry_focus_next_entry (YGtkFieldEntry *fields,
+ GtkEntry *current_entry, gint side)
{
GList *children = gtk_container_get_children (GTK_CONTAINER (fields));
gint pos = g_list_index (children, current_entry);
- YGtkFilterEntry *next_entry = g_list_nth_data (children, pos + (2 * side));
+ GtkEntry *next_entry = g_list_nth_data (children, pos + (2 * side));
g_list_free (children);
if (next_entry)
@@ -110,8 +41,8 @@
gint new_text_length, gint *position, YGtkFieldEntry *fields)
{
if (*position == gtk_entry_get_max_length (GTK_ENTRY (editable))) {
- YGtkFilterEntry *next_entry = ygtk_field_entry_focus_next_entry (fields,
- YGTK_FILTER_ENTRY (editable), 1);
+ GtkEntry *next_entry = ygtk_field_entry_focus_next_entry (fields,
+ GTK_ENTRY (editable), 1);
if (next_entry) {
gint pos = 0;
gtk_editable_insert_text (GTK_EDITABLE (next_entry), new_text,
@@ -129,39 +60,60 @@
{
if (move == GTK_MOVEMENT_VISUAL_POSITIONS) {
if (count > 0)
- ygtk_field_entry_focus_next_entry (fields, YGTK_FILTER_ENTRY (entry), 1);
+ ygtk_field_entry_focus_next_entry (fields, GTK_ENTRY (entry), 1);
else
- ygtk_field_entry_focus_next_entry (fields, YGTK_FILTER_ENTRY (entry), -1);
+ ygtk_field_entry_focus_next_entry (fields, GTK_ENTRY (entry), -1);
}
}
+
+GtkWidget *ygtk_field_entry_new (void)
+{
+ return g_object_new (YGTK_TYPE_FIELD_ENTRY, NULL);
+}
+
static void ygtk_field_entry_entry_changed (GtkEditable *editable, YGtkFieldEntry *fields)
{
GList *children = gtk_container_get_children (GTK_CONTAINER (fields));
- gint nb = g_list_index (children, YGTK_FILTER_ENTRY (editable)) / 2;
+ gint nb = g_list_index (children, editable) / 2;
g_list_free (children);
g_signal_emit (fields, filter_entry_signal, 0, nb);
}
-GtkWidget *ygtk_field_entry_new (void)
+static guint ygtk_field_entry_length (YGtkFieldEntry *fields)
{
- return g_object_new (YGTK_TYPE_FIELD_ENTRY, NULL);
+ guint length;
+ GList *children = gtk_container_get_children (GTK_CONTAINER (fields));
+ length = g_list_length (children);
+ g_list_free (children);
+ return length;
}
-void ygtk_field_entry_add_field (YGtkFieldEntry *fields, gchar separator,
- guint max_length, const gchar *valid_chars)
+static inline guint child_to_index (YGtkFieldEntry *fields, guint child_i)
+{ return child_i / 2; }
+static inline guint index_to_child (YGtkFieldEntry *fields, guint index)
+{ return index * 2; }
+
+GtkEntry *ygtk_field_entry_get_field_widget (YGtkFieldEntry *fields, guint index)
{
+ GtkEntry *entry;
+ GList *children = gtk_container_get_children (GTK_CONTAINER (fields));
+ entry = g_list_nth_data (children, index_to_child (fields, index));
+ g_list_free (children);
+ g_assert (GTK_IS_ENTRY (entry));
+ return entry;
+}
+guint ygtk_field_entry_add_field (YGtkFieldEntry *fields, gchar separator)
+{
+ guint new_index = child_to_index (fields, ygtk_field_entry_length (fields)+1);
+
GtkWidget *label = 0, *entry;
- if (fields->use_separator) {
+ if (new_index > 0) {
const gchar str[2] = { separator, '\0' };
label = gtk_label_new (str);
}
- entry = ygtk_filter_entry_new();
- gtk_entry_set_max_length (GTK_ENTRY (entry), max_length);
- gtk_entry_set_width_chars (GTK_ENTRY (entry), (max_length == 0) ? -1 : max_length);
- ygtk_filter_entry_set_valid_chars (YGTK_FILTER_ENTRY (entry), valid_chars);
-
+ entry = gtk_entry_new();
g_signal_connect (G_OBJECT (entry), "insert-text",
G_CALLBACK (ygtk_field_entry_insert_text), fields);
g_signal_connect (G_OBJECT (entry), "move-cursor",
@@ -171,33 +123,37 @@
G_CALLBACK (ygtk_field_entry_entry_changed), fields);
GtkBox *box = GTK_BOX (fields);
- if (label)
- gtk_box_pack_start (box, label, FALSE, FALSE, 0);
+ if (label) {
+ gtk_box_pack_start (box, label, FALSE, TRUE, 0);
+ gtk_widget_show (label);
+ }
gtk_box_pack_start (box, entry, TRUE, TRUE, 0);
-
- fields->use_separator = TRUE;
+ gtk_widget_show (entry);
+ return new_index;
}
-static YGtkFilterEntry *ygtk_field_entry_get_field (YGtkFieldEntry *fields, guint nb)
+void ygtk_field_entry_setup_field (YGtkFieldEntry *fields, guint index,
+ gint max_length, const gchar *valid_chars)
{
- YGtkFilterEntry *entry;
-
- GList *children = gtk_container_get_children (GTK_CONTAINER (fields));
- entry = g_list_nth_data (children, nb * 2);
- g_list_free (children);
-
- return entry;
+ GtkEntry *entry = ygtk_field_entry_get_field_widget (fields, index);
+ gboolean disable_len = (max_length <= 0);
+ gtk_entry_set_max_length (entry, disable_len ? 0 : max_length);
+ gtk_entry_set_width_chars (entry, disable_len ? -1 : max_length);
+ gtk_box_set_child_packing (GTK_BOX (fields), GTK_WIDGET (entry),
+ disable_len, TRUE, 0, GTK_PACK_START);
+ ygutils_setFilter (entry, valid_chars);
}
-void ygtk_field_entry_set_field_text (YGtkFieldEntry *fields, guint nb, const gchar *text)
+void ygtk_field_entry_set_field_text (YGtkFieldEntry *fields, guint index, const gchar *text)
{
- YGtkFilterEntry *entry = ygtk_field_entry_get_field (fields, nb);
+ GtkEntry *entry = ygtk_field_entry_get_field_widget (fields, index);
+
g_signal_handlers_block_by_func (entry,
(gpointer) ygtk_field_entry_entry_changed, fields);
g_signal_handlers_block_by_func (entry,
(gpointer) ygtk_field_entry_insert_text, fields);
- gtk_entry_set_text (GTK_ENTRY (entry), text);
+ gtk_entry_set_text (entry, text);
g_signal_handlers_unblock_by_func (entry,
(gpointer) ygtk_field_entry_entry_changed, fields);
@@ -205,10 +161,10 @@
(gpointer) ygtk_field_entry_insert_text, fields);
}
-const gchar *ygtk_field_entry_get_field_text (YGtkFieldEntry *fields, guint nb)
+const gchar *ygtk_field_entry_get_field_text (YGtkFieldEntry *fields, guint index)
{
- YGtkFilterEntry *entry = ygtk_field_entry_get_field (fields, nb);
- return gtk_entry_get_text (GTK_ENTRY (entry));
+ GtkEntry *entry = ygtk_field_entry_get_field_widget (fields, index);
+ return gtk_entry_get_text (entry);
}
static void ygtk_field_entry_class_init (YGtkFieldEntryClass *klass)
@@ -220,3 +176,4 @@
G_STRUCT_OFFSET (YGtkFieldEntryClass, filter_entry_changed),
NULL, NULL, gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}
+
Modified: trunk/gtk/src/ygtkfieldentry.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfieldentry.h?rev=432…
==============================================================================
--- trunk/gtk/src/ygtkfieldentry.h (original)
+++ trunk/gtk/src/ygtkfieldentry.h Thu Dec 20 21:44:06 2007
@@ -7,55 +7,13 @@
you need the user to set a IP address or time/date). The number
of fields, their individual range and separation character
is all customizable.
-
- YGtkFilterEntry is an extension to GtkEntry that only accepts
- input that is specified in an array of valid characters
*/
-#ifndef YGTK_FILTER_ENTRY_H
-#define YGTK_FILTER_ENTRY_H
-
-#include <gtk/gtkentry.h>
-G_BEGIN_DECLS
-
-#define YGTK_TYPE_FILTER_ENTRY (ygtk_filter_entry_get_type ())
-#define YGTK_FILTER_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- YGTK_TYPE_FILTER_ENTRY, YGtkFilterEntry))
-#define YGTK_FILTER_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
- YGTK_TYPE_FILTER_ENTRY, YGtkFilterEntryClass))
-#define YGTK_IS_FILTER_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- YGTK_TYPE_FILTER_ENTRY))
-#define YGTK_IS_FILTER_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- YGTK_TYPE_FILTER_ENTRY))
-#define YGTK_FILTER_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- YGTK_TYPE_FILTER_ENTRY, YGtkFilterEntryClass))
-
-typedef struct _YGtkFilterEntry
-{
- GtkEntry parent;
-
- // private:
- gchar *valid_chars;
-} YGtkFilterEntry;
-
-typedef struct _YGtkFilterEntryClass
-{
- GtkEntryClass parent_class;
-} YGtkFilterEntryClass;
-
-GtkWidget* ygtk_filter_entry_new (void);
-GType ygtk_filter_entry_get_type (void) G_GNUC_CONST;
-
-void ygtk_filter_entry_set_valid_chars (YGtkFilterEntry *entry,
- const gchar *valid_chars);
-
-G_END_DECLS
-#endif /*YGTK_FILTER_ENTRY_H*/
-
#ifndef YGTK_FIELD_ENTRY_H
#define YGTK_FIELD_ENTRY_H
#include <gtk/gtkhbox.h>
+#include <gtk/gtkentry.h>
G_BEGIN_DECLS
#define YGTK_TYPE_FIELD_ENTRY (ygtk_field_entry_get_type ())
@@ -73,10 +31,6 @@
typedef struct _YGtkFieldEntry
{
GtkHBox parent;
-
- // private:
- // used to disable separator for the first field
- gboolean use_separator;
} YGtkFieldEntry;
typedef struct _YGtkFieldEntryClass
@@ -89,14 +43,17 @@
GtkWidget* ygtk_field_entry_new (void);
GType ygtk_field_entry_get_type (void) G_GNUC_CONST;
-// if this is the first field, separator will be ignored. max_length can be 0 to
-// disable it. valids_chars can be NULL to disable it.
-void ygtk_field_entry_add_field (YGtkFieldEntry *entry, gchar separator,
- guint max_length, const gchar *valid_chars);
-
-// convinience
-void ygtk_field_entry_set_field_text (YGtkFieldEntry *entry, guint nb, const gchar *text);
-const gchar *ygtk_field_entry_get_field_text (YGtkFieldEntry *entry, guint nb);
+// if this is the first field, separator will be ignored.
+guint ygtk_field_entry_add_field (YGtkFieldEntry *entry, gchar separator);
+//max_length can be 0 to disable it. valids_chars can be NULL to disable it.
+void ygtk_field_entry_setup_field (YGtkFieldEntry *entry, guint index,
+ gint max_length, const gchar *valid_chars);
+
+void ygtk_field_entry_set_field_text (YGtkFieldEntry *entry, guint index, const gchar *text);
+const gchar *ygtk_field_entry_get_field_text (YGtkFieldEntry *entry, guint index);
+
+GtkEntry *ygtk_field_entry_get_field_widget (YGtkFieldEntry *entry, guint index);
G_END_DECLS
#endif /*YGTK_FIELD_ENTRY_H*/
+
Modified: trunk/gtk/src/ygtkfindentry.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfindentry.c?rev=4321…
==============================================================================
--- trunk/gtk/src/ygtkfindentry.c (original)
+++ trunk/gtk/src/ygtkfindentry.c Thu Dec 20 21:44:06 2007
@@ -128,7 +128,7 @@
gdk_window_set_user_data (*window, widget);
// set background style
ygtk_ext_entry_sync_color (entry);
-
+
if (GTK_WIDGET_MAPPED (widget))
gdk_window_show (*window);
gtk_widget_queue_resize (widget);
@@ -349,12 +349,13 @@
gdk_window_set_cursor (eentry->left_window, cursor);
gdk_window_set_cursor (eentry->right_window, cursor);
gdk_cursor_unref (cursor);
+ gdk_window_hide (eentry->right_window); // show when text is inserted
}
static void ygtk_find_entry_map (GtkWidget *widget)
{
- if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget)) {
- GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->map (widget);
+ GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->map (widget);
+ if (GTK_WIDGET_REALIZED (widget)) {
// only show clear icon when the entry has text
GdkWindow *clear_win = YGTK_EXT_ENTRY (widget)->right_window;
if (clear_win)
@@ -470,14 +471,9 @@
(ygtk_find_entry_parent_class, GTK_TYPE_EDITABLE);
parent_editable_iface->delete_text (editable, start_pos, end_pos);
- int has_text = strlen (gtk_entry_get_text (GTK_ENTRY (editable)));
- if (!has_text) {
- /* Set or delete text may be called while the widget has not yet been
- realized. */
- GdkWindow *clear_win = YGTK_EXT_ENTRY (editable)->right_window;
- if (clear_win)
- gdk_window_hide (clear_win);
- }
+ GdkWindow *clear_win = YGTK_EXT_ENTRY (editable)->right_window;
+ if (clear_win)
+ gdk_window_hide (clear_win);
}
void ygtk_find_entry_attach_menu (YGtkFindEntry *entry, GtkMenu *menu)
Modified: trunk/gtk/src/ygtkimage.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkimage.c?rev=43216&r1…
==============================================================================
--- trunk/gtk/src/ygtkimage.c (original)
+++ trunk/gtk/src/ygtkimage.c Thu Dec 20 21:44:06 2007
@@ -157,7 +157,8 @@
image->align = align;
if (image->alt_text)
g_free (image->alt_text);
- image->alt_text = g_strdup (alt_text);
+ if (alt_text)
+ image->alt_text = g_strdup (alt_text);
gtk_widget_queue_draw (GTK_WIDGET (image));
}
@@ -208,21 +209,23 @@
cairo_t *cr = gdk_cairo_create (widget->window);
- if (!image->loaded && image->alt_text) {
- // show alt text if no image was loaded
- PangoLayout *layout;
- layout = gtk_widget_create_pango_layout (widget, image->alt_text);
-
- int x, y;
- x = (width - widget->requisition.width) / 2;
- y = (height - widget->requisition.height) / 2;
+ if (!image->loaded) {
+ if (image->alt_text) {
+ // show alt text if no image was loaded
+ PangoLayout *layout;
+ layout = gtk_widget_create_pango_layout (widget, image->alt_text);
+
+ int x, y;
+ x = (width - widget->requisition.width) / 2;
+ y = (height - widget->requisition.height) / 2;
- cairo_move_to (cr, x, y);
- pango_cairo_show_layout (cr, layout);
+ cairo_move_to (cr, x, y);
+ pango_cairo_show_layout (cr, layout);
- g_object_unref (layout);
+ g_object_unref (layout);
+ }
cairo_destroy (cr);
- return TRUE;
+ return FALSE;
}
GdkPixbuf *pixbuf;
Modified: trunk/gtk/src/ygtkmenubutton.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkmenubutton.c?rev=432…
==============================================================================
--- trunk/gtk/src/ygtkmenubutton.c (original)
+++ trunk/gtk/src/ygtkmenubutton.c Thu Dec 20 21:44:06 2007
@@ -104,22 +104,13 @@
button->label = gtk_label_new ("");
GtkWidget *hbox, *arrow;
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_hbox_new (FALSE, 4);
arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
+ gtk_widget_show (hbox);
+ gtk_widget_show (arrow);
- if (gtk_widget_get_direction (arrow) == GTK_TEXT_DIR_LTR) {
- gtk_container_add (GTK_CONTAINER (hbox), button->label);
- gtk_container_add (GTK_CONTAINER (hbox), arrow);
- }
- else {
- gtk_container_add (GTK_CONTAINER (hbox), arrow);
- gtk_container_add (GTK_CONTAINER (hbox), button->label);
- }
-
- gtk_box_set_child_packing (GTK_BOX (hbox), arrow, FALSE, FALSE,
- 5, GTK_PACK_START);
-
- gtk_widget_show_all (hbox);
+ gtk_box_pack_start (GTK_BOX (hbox), button->label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (button), hbox);
}
Modified: trunk/gtk/src/ygtkratiobox.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.c?rev=43216…
==============================================================================
--- trunk/gtk/src/ygtkratiobox.c (original)
+++ trunk/gtk/src/ygtkratiobox.c Thu Dec 20 21:44:06 2007
@@ -521,18 +521,18 @@
widget_class->size_allocate = ygtk_adj_size_size_allocate;
}
-//** YGtkScrolledWindow
+//** YGtkTunedScrolledWindow
-G_DEFINE_TYPE (YGtkScrolledWindow, ygtk_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
+G_DEFINE_TYPE (YGtkTunedScrolledWindow, ygtk_tuned_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
-static void ygtk_scrolled_window_init (YGtkScrolledWindow *scroll)
+static void ygtk_tuned_scrolled_window_init (YGtkTunedScrolledWindow *scroll)
{
}
-static void ygtk_scrolled_window_size_request (GtkWidget *widget,
+static void ygtk_tuned_scrolled_window_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
- YGtkScrolledWindow *scroll = YGTK_SCROLLED_WINDOW (widget);
+ YGtkTunedScrolledWindow *scroll = YGTK_TUNED_SCROLLED_WINDOW (widget);
GtkRequisition child_req;
GtkWidget *child = GTK_BIN (widget)->child;
@@ -555,31 +555,33 @@
gscroll->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
}
- GTK_WIDGET_CLASS (ygtk_scrolled_window_parent_class)->size_request (widget, requisition);
- // to avoid disruptions:
- requisition->width = MIN (requisition->width, scroll->max_width);
- requisition->height = MIN (requisition->height, scroll->max_height);
+ GTK_WIDGET_CLASS (ygtk_tuned_scrolled_window_parent_class)->size_request (widget, requisition);
+ if (scroll->max_width)
+ requisition->width = MIN (requisition->width, scroll->max_width);
+ if (scroll->max_height)
+ requisition->height = MIN (requisition->height, scroll->max_height);
}
-GtkWidget* ygtk_scrolled_window_new (GtkWidget *child)
+GtkWidget* ygtk_tuned_scrolled_window_new (GtkWidget *child)
{
- YGtkScrolledWindow *scroll = g_object_new (YGTK_TYPE_SCROLLED_WINDOW, NULL);
+ YGtkTunedScrolledWindow *scroll = g_object_new (YGTK_TYPE_TUNED_SCROLLED_WINDOW, NULL);
if (child)
gtk_container_add (GTK_CONTAINER (scroll), child);
return GTK_WIDGET (scroll);
}
-void ygtk_scrolled_window_set_auto_policy (YGtkScrolledWindow *scroll,
+void ygtk_tuned_scrolled_window_set_auto_policy (YGtkTunedScrolledWindow *scroll,
guint max_width, guint max_height)
{
scroll->max_width = max_width;
scroll->max_height = max_height;
}
-static void ygtk_scrolled_window_class_init (YGtkScrolledWindowClass *klass)
+static void ygtk_tuned_scrolled_window_class_init (YGtkTunedScrolledWindowClass *klass)
{
- ygtk_scrolled_window_parent_class = g_type_class_peek_parent (klass);
+ ygtk_tuned_scrolled_window_parent_class = g_type_class_peek_parent (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->size_request = ygtk_scrolled_window_size_request;
+ widget_class->size_request = ygtk_tuned_scrolled_window_size_request;
}
+
Modified: trunk/gtk/src/ygtkratiobox.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.h?rev=43216…
==============================================================================
--- trunk/gtk/src/ygtkratiobox.h (original)
+++ trunk/gtk/src/ygtkratiobox.h Thu Dec 20 21:44:06 2007
@@ -199,41 +199,42 @@
/* YGtkScrolledWindow gives some a more fine-grained automatic scroll policy.
It allows the user to specify from which size scrolling should be applied. */
-#ifndef YGTK_SCROLLED_WIDOW_H
-#define YGTK_SCROLLED_WIDOW_H
+#ifndef YGTK_TUNED_SCROLLED_WIDOW_H
+#define YGTK_TUNED_SCROLLED_WIDOW_H
#include <gtk/gtkscrolledwindow.h>
G_BEGIN_DECLS
-#define YGTK_TYPE_SCROLLED_WINDOW (ygtk_scrolled_window_get_type ())
-#define YGTK_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindow))
-#define YGTK_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
- YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindowClass))
-#define YGTK_IS_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- YGTK_TYPE_SCROLLED_WINDOW))
-#define YGTK_IS_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- YGTK_TYPE_SCROLLED_WINDOW))
-#define YGTK_SCROLLED_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindowClass))
+#define YGTK_TYPE_TUNED_SCROLLED_WINDOW (ygtk_tuned_scrolled_window_get_type ())
+#define YGTK_TUNED_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, YGtkTunedScrolledWindow))
+#define YGTK_TUNED_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, YGtkTunedScrolledWindowClass))
+#define YGTK_IS_TUNED_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW))
+#define YGTK_IS_TUNED_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW))
+#define YGTK_TUNED_SCROLLED_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, YGtkTunedScrolledWindowClass))
-typedef struct _YGtkScrolledWindow
+typedef struct _YGtkTunedScrolledWindow
{
GtkScrolledWindow parent;
// members
guint max_width, max_height;
-} YGtkScrolledWindow;
+} YGtkTunedScrolledWindow;
-typedef struct _YGtkScrolledWindowClass
+typedef struct _YGtkTunedScrolledWindowClass
{
GtkScrolledWindowClass parent_class;
-} YGtkScrolledWindowClass;
+} YGtkTunedScrolledWindowClass;
-GType ygtk_scrolled_window_get_type (void) G_GNUC_CONST;
-GtkWidget* ygtk_scrolled_window_new (GtkWidget *child /*or NULL*/);
+GType ygtk_tuned_scrolled_window_get_type (void) G_GNUC_CONST;
+GtkWidget* ygtk_tuned_scrolled_window_new (GtkWidget *child /*or NULL*/);
-void ygtk_scrolled_window_set_auto_policy (YGtkScrolledWindow *scroll,
- guint max_width, guint max_height);
+void ygtk_tuned_scrolled_window_set_auto_policy (YGtkTunedScrolledWindow *scroll,
+ guint max_width, guint max_height);
G_END_DECLS
-#endif /*YGTK_SCROLLED_WIDOW_H*/
+#endif /*YGTK_TUNED_SCROLLED_WIDOW_H*/
+
Modified: trunk/gtk/src/ygtkrichtext.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.c?rev=43216…
==============================================================================
--- trunk/gtk/src/ygtkrichtext.c (original)
+++ trunk/gtk/src/ygtkrichtext.c Thu Dec 20 21:44:06 2007
@@ -539,28 +539,36 @@
}
/* String preparation methods. */
-
-#define IS_WHITE(c) (g_ascii_isspace (c) || (c) == '\t')
-
static char *elide_whitespace (const char *instr, int len)
{
GString *dest = g_string_new ("");
if (len < 0)
len = strlen (instr);
gboolean last_white = FALSE;
+ // transform breaklines in whitespace if in the middle of the text
+ gboolean special_white = FALSE, start_text = TRUE;
int i;
-// FIXME: whitespace elision needs to happen across tags [urk]
-// FIXME: perhaps post-process non-pre sections when they are complete ?
for (i = 0; i < len; i++)
{
char ch = instr[i];
- if (ch == '\r' || ch == '\n')
+ if (ch == '\n') {
+ if (!start_text)
+ special_white = TRUE;
continue;
+ }
if (ch == '\t')
ch = ' ';
- gboolean cur_white = IS_WHITE (ch);
+ gboolean cur_white = ch == ' ';
+ if (!cur_white) {
+ start_text = FALSE;
+ if (special_white) {
+ g_string_append_c (dest, ' ');
+ special_white = FALSE;
+ }
+ }
if (!cur_white || !last_white)
g_string_append_c (dest, ch);
+
last_white = cur_white;
}
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=43216&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Thu Dec 20 21:44:06 2007
@@ -265,8 +265,13 @@
static void button_clicked_cb (GtkButton *button, YGtkWizard *wizard)
{
- gpointer id = g_object_get_data (G_OBJECT (button), "id");
- g_signal_emit (wizard, action_triggered_signal, 0, id, G_TYPE_POINTER);
+ gpointer id;
+ id = g_object_get_data (G_OBJECT (button), "ptr-id");
+ if (id)
+ g_signal_emit (wizard, action_triggered_signal, 0, id, G_TYPE_POINTER);
+ id = g_object_get_data (G_OBJECT (button), "str-id");
+ if (id)
+ g_signal_emit (wizard, action_triggered_signal, 0, id, G_TYPE_STRING);
}
static GtkWidget *button_new (YGtkWizard *wizard)
@@ -305,6 +310,7 @@
g_free, NULL);
gtk_container_set_border_width (GTK_CONTAINER (wizard), BORDER);
+ wizard->child_border_width = CHILD_BORDER;
//** Title
wizard->m_title = gtk_hbox_new (FALSE, 0);
@@ -403,12 +409,10 @@
/* We must unparent these widgets from the wizard as they would try
to use gtk_container_remove() on it. We ref them since we still
want to call destroy on them so they children die. */
-#define DESTROY_WIDGET(widget) \
- if (widget) { \
- g_object_ref (G_OBJECT (widget)); \
- gtk_widget_unparent (widget); \
- gtk_widget_destroy (widget); \
- widget = NULL; \
+#define DESTROY_WIDGET(widget) \
+ if (widget) { \
+ gtk_widget_unparent (widget); \
+ widget = NULL; \
}
DESTROY_WIDGET (wizard->m_title)
DESTROY_WIDGET (wizard->m_buttons)
@@ -645,31 +649,53 @@
ygutils_setStockIcon (wizard->m_next_button, text);
}
-void ygtk_wizard_set_back_button_id (YGtkWizard *wizard, gpointer id,
- GDestroyNotify destroy_cb)
+void ygtk_wizard_set_back_button_ptr_id (YGtkWizard *wizard, gpointer id)
+{
+ g_object_set_data (G_OBJECT (wizard->m_back_button), "ptr-id", id);
+}
+
+void ygtk_wizard_set_next_button_ptr_id (YGtkWizard *wizard, gpointer id)
{
- g_object_set_data_full (G_OBJECT (wizard->m_back_button), "id", id, destroy_cb);
+ g_object_set_data (G_OBJECT (wizard->m_next_button), "ptr-id", id);
}
-void ygtk_wizard_set_next_button_id (YGtkWizard *wizard, gpointer id,
- GDestroyNotify destroy_cb)
+void ygtk_wizard_set_abort_button_ptr_id (YGtkWizard *wizard, gpointer id)
{
- g_object_set_data_full (G_OBJECT (wizard->m_next_button), "id", id, destroy_cb);
+ g_object_set_data (G_OBJECT (wizard->m_abort_button), "ptr-id", id);
}
-void ygtk_wizard_set_abort_button_id (YGtkWizard *wizard, gpointer id,
- GDestroyNotify destroy_cb)
+void ygtk_wizard_set_release_notes_button_ptr_id (YGtkWizard *wizard, gpointer id)
{
- g_object_set_data_full (G_OBJECT (wizard->m_abort_button), "id", id, destroy_cb);
+ g_object_set_data (G_OBJECT (wizard->m_release_notes_button), "ptr-id", id);
}
-void ygtk_wizard_set_release_notes_button_label (YGtkWizard *wizard,
- const gchar *text, gpointer id,
- GDestroyNotify destroy_cb)
+void ygtk_wizard_set_back_button_str_id (YGtkWizard *wizard, const char *id)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_back_button), "str-id",
+ g_strdup (id), g_free);
+}
+
+void ygtk_wizard_set_next_button_str_id (YGtkWizard *wizard, const char *id)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_next_button), "str-id",
+ g_strdup (id), g_free);
+}
+
+void ygtk_wizard_set_abort_button_str_id (YGtkWizard *wizard, const char *id)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_abort_button), "str-id",
+ g_strdup (id), g_free);
+}
+
+void ygtk_wizard_set_release_notes_button_str_id (YGtkWizard *wizard, const char *id)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_release_notes_button), "str-id",
+ g_strdup (id), g_free);
+}
+
+void ygtk_wizard_set_release_notes_button_label (YGtkWizard *wizard, const gchar *text)
{
gtk_button_set_label (GTK_BUTTON (wizard->m_release_notes_button), text);
- g_object_set_data_full (G_OBJECT (wizard->m_release_notes_button), "id",
- id, destroy_cb);
gtk_widget_show (wizard->m_release_notes_button);
}
@@ -784,6 +810,18 @@
return TRUE;
}
+void ygtk_wizard_clear_menu (YGtkWizard *wizard)
+{
+ if (!wizard->m_menu)
+ return;
+ yg_hash_table_remove_all (wizard->menu_ids);
+ GList *children = gtk_container_get_children (GTK_CONTAINER (wizard->m_menu)), *i;
+ for (i = children; i; i = i->next) {
+ GtkWidget *child = (GtkWidget *) i->data;
+ gtk_container_remove (GTK_CONTAINER (wizard->m_menu), child);
+ }
+}
+
void ygtk_wizard_add_step_header (YGtkWizard *wizard, const char *text)
{
g_return_if_fail (wizard->m_steps != NULL);
@@ -856,6 +894,7 @@
YGtkWizard *wizard = YGTK_WIZARD (widget);
gint border = GTK_CONTAINER (wizard)->border_width;
+ gint child_border = wizard->child_border_width;
gint header_padding = get_header_padding (GTK_WIDGET (wizard));
gint content_padding = get_content_padding (GTK_WIDGET (wizard));
GtkRequisition req; // temp usage
@@ -894,8 +933,8 @@
gtk_widget_size_request (child, &child_req);
else
child_req.width = child_req.height = 0;
- child_req.width += content_padding * 2 + CHILD_BORDER*2;
- child_req.height += content_padding * 2 + CHILD_BORDER*2;
+ child_req.width += content_padding * 2 + child_border*2;
+ child_req.height += content_padding * 2 + child_border*2;
req.width = nav_req.width + child_req.width + border*2;
req.height = MAX (nav_req.height, child_req.height);
@@ -995,7 +1034,7 @@
// child
GtkWidget *child = GTK_BIN (wizard)->child;
if (child && GTK_WIDGET_VISIBLE (child)) {
- apply_allocation_padding (&child_area, content_padding + CHILD_BORDER);
+ apply_allocation_padding (&child_area, content_padding + wizard->child_border_width);
gtk_widget_size_allocate (child, &child_area);
}
@@ -1087,6 +1126,150 @@
(*callback) (containee, callback_data);
}
+/* Accessibility support */
+
+static gint ygtk_wizard_accessible_get_n_children (AtkObject *accessible)
+{
+ return 1 /* content*/ + 5 /* buttons*/;
+}
+
+static AtkObject *ygtk_wizard_accessible_ref_child (AtkObject *accessible,
+ gint index)
+{
+ GtkWidget *widget = GTK_ACCESSIBLE (accessible)->widget;
+ if (!widget)
+ return NULL;
+ YGtkWizard *wizard = YGTK_WIZARD (widget);
+
+ if (index == 0) {
+ GtkWidget *child = GTK_BIN (wizard)->child;
+ if (child)
+ return g_object_ref (G_OBJECT (child));
+ return NULL;
+ }
+
+ if (index >= 1 && index <= 5) {
+ GtkWidget *buttons[5] = { wizard->m_back_button, wizard->m_abort_button,
+ wizard->m_next_button, wizard->m_help_button,
+ wizard->m_release_notes_button };
+ GtkWidget *button = buttons [index-1];
+
+ if (GTK_WIDGET_VISIBLE (button))
+ return g_object_ref (G_OBJECT (button));
+ return NULL;
+ }
+ // out of range
+ return NULL;
+}
+
+static void ygtk_wizard_accessible_class_init (AtkObjectClass *class)
+{
+ class->get_n_children = ygtk_wizard_accessible_get_n_children;
+ class->ref_child = ygtk_wizard_accessible_ref_child;
+}
+
+static GType ygtk_wizard_accessible_get_type (void)
+{
+ static GType type = 0;
+ if (!type) {
+ AtkObjectFactory *factory;
+ GType derived_type;
+ GTypeQuery query;
+ GType derived_atk_type;
+
+ derived_type = g_type_parent (YGTK_TYPE_WIZARD);
+ factory = atk_registry_get_factory (atk_get_default_registry (), derived_type);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+
+ GTypeInfo type_info = { 0 };
+ type_info.class_size = query.class_size;
+ type_info.class_init = (GClassInitFunc) ygtk_wizard_accessible_class_init;
+ type_info.instance_size = query.instance_size;
+
+ type = g_type_register_static (derived_atk_type, "YGtkWizardAccessible",
+ &type_info, 0);
+
+/*
+ type = g_type_register_static_simple (derived_atk_type,
+ "YGtkWizardAccessible", query.class_size,
+ (GClassInitFunc) ygtk_wizard_accessible_class_init,
+ query.instance_size, NULL, 0);
+*/
+ }
+ return type;
+}
+
+static AtkObject *ygtk_wizard_accessible_new (GObject *obj)
+{
+ AtkObject *accessible;
+ g_return_val_if_fail (YGTK_IS_WIZARD (obj), NULL);
+
+ accessible = g_object_new (ygtk_wizard_accessible_get_type (), NULL);
+ atk_object_initialize (accessible, obj);
+ return accessible;
+}
+
+static GType ygtk_wizard_accessible_factory_get_accessible_type()
+{
+ return ygtk_wizard_accessible_get_type ();
+}
+
+static AtkObject*ygtk_wizard_accessible_factory_create_accessible (GObject *obj)
+{
+ return ygtk_wizard_accessible_new (obj);
+}
+
+static void ygtk_wizard_accessible_factory_class_init (AtkObjectFactoryClass *class)
+{
+ class->create_accessible = ygtk_wizard_accessible_factory_create_accessible;
+ class->get_accessible_type = ygtk_wizard_accessible_factory_get_accessible_type;
+}
+
+static GType ygtk_wizard_accessible_factory_get_type (void)
+{
+ static GType type = 0;
+ if (!type) {
+ GTypeInfo type_info = { 0 };
+ type_info.class_size = sizeof (AtkObjectFactoryClass);
+ type_info.class_init = (GClassInitFunc) ygtk_wizard_accessible_factory_class_init;
+ type_info.instance_size = sizeof (AtkObjectFactory);
+
+ type = g_type_register_static (ATK_TYPE_OBJECT_FACTORY,
+ "YGtkWizardAccessibleFactory", &type_info, 0);
+
+/*
+ type = g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY,
+ "YGtkWizardAccessibleFactory", sizeof (AtkObjectFactoryClass),
+ (GClassInitFunc) ygtk_wizard_accessible_factory_class_init,
+ sizeof (AtkObjectFactory), NULL, 0);
+*/
+ }
+ return type;
+}
+
+static AtkObject *ygtk_wizard_get_accessible (GtkWidget *widget)
+{
+ static gboolean first_time = TRUE;
+ if (first_time) {
+ AtkObjectFactory *factory;
+ AtkRegistry *registry;
+ GType derived_type;
+ GType derived_atk_type;
+
+ derived_type = g_type_parent (YGTK_TYPE_WIZARD);
+ registry = atk_get_default_registry ();
+ factory = atk_registry_get_factory (registry, derived_type);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE)) {
+ atk_registry_set_factory_type (registry, YGTK_TYPE_WIZARD,
+ ygtk_wizard_accessible_factory_get_type ());
+ }
+ first_time = FALSE;
+ }
+ return GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->get_accessible (widget);
+}
+
static void ygtk_wizard_class_init (YGtkWizardClass *klass)
{
ygtk_wizard_parent_class = g_type_class_peek_parent (klass);
@@ -1097,6 +1280,7 @@
widget_class->realize = ygtk_wizard_realize;
widget_class->size_request = ygtk_wizard_size_request;
widget_class->size_allocate = ygtk_wizard_size_allocate;
+ widget_class->get_accessible = ygtk_wizard_get_accessible;
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
container_class->forall = ygtk_wizard_forall;
Modified: trunk/gtk/src/ygtkwizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.h?rev=43216&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.h (original)
+++ trunk/gtk/src/ygtkwizard.h Thu Dec 20 21:44:06 2007
@@ -93,6 +93,8 @@
/* The help text. */
gchar *m_help;
GtkWidget *m_help_dialog;
+
+ guint child_border_width;
} YGtkWizard;
typedef struct _YGtkWizardClass
@@ -129,12 +131,14 @@
void ygtk_wizard_set_back_button_label (YGtkWizard *wizard, const char *text);
void ygtk_wizard_set_abort_button_label (YGtkWizard *wizard, const char *text);
void ygtk_wizard_set_next_button_label (YGtkWizard *wizard, const char *text);
-void ygtk_wizard_set_back_button_id (YGtkWizard *wizard, gpointer id,
- GDestroyNotify destroy_cb);
-void ygtk_wizard_set_next_button_id (YGtkWizard *wizard, gpointer id,
- GDestroyNotify destroy_cb);
-void ygtk_wizard_set_abort_button_id (YGtkWizard *wizard, gpointer id,
- GDestroyNotify destroy_cb);
+void ygtk_wizard_set_back_button_str_id (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_set_next_button_str_id (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_set_abort_button_str_id (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_set_release_notes_button_str_id (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_set_back_button_ptr_id (YGtkWizard *wizard, gpointer id);
+void ygtk_wizard_set_next_button_ptr_id (YGtkWizard *wizard, gpointer id);
+void ygtk_wizard_set_abort_button_ptr_id (YGtkWizard *wizard, gpointer id);
+void ygtk_wizard_set_release_notes_button_ptr_id (YGtkWizard *wizard, gpointer id);
void ygtk_wizard_enable_back_button (YGtkWizard *wizard, gboolean enable);
void ygtk_wizard_enable_next_button (YGtkWizard *wizard, gboolean enable);
void ygtk_wizard_enable_abort_button (YGtkWizard *wizard, gboolean enable);
@@ -150,6 +154,7 @@
gboolean ygtk_wizard_add_sub_menu (YGtkWizard *wizard, const char *parent_id,
const char *text, const char *id);
gboolean ygtk_wizard_add_menu_separator (YGtkWizard *wizard, const char *parent_id);
+void ygtk_wizard_clear_menu (YGtkWizard *wizard);
void ygtk_wizard_add_step_header (YGtkWizard *wizard, const char *text);
void ygtk_wizard_add_step (YGtkWizard *wizard, const char* text, const char *id);
@@ -162,9 +167,7 @@
gboolean ygtk_wizard_select_tree_item (YGtkWizard *wizard, const char *id);
const gchar *ygtk_wizard_get_tree_selection (YGtkWizard *wizard);
-void ygtk_wizard_set_release_notes_button_label (YGtkWizard *wizard,
- const gchar *text, gpointer id,
- GDestroyNotify destroy_cb);
+void ygtk_wizard_set_release_notes_button_label (YGtkWizard *wizard, const gchar *text);
void ygtk_wizard_show_release_notes_button (YGtkWizard *wizard, gboolean enable);
// You should call this method rather than GtkWidget's if you want
Modified: trunk/gtk/src/ygtkzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppwrapper.cc?rev=4…
==============================================================================
--- trunk/gtk/src/ygtkzyppwrapper.cc (original)
+++ trunk/gtk/src/ygtkzyppwrapper.cc Thu Dec 20 21:44:06 2007
@@ -19,7 +19,6 @@
#include "icons/pkg-remove.xpm"
#include "icons/pkg-install-auto.xpm"
#include "icons/pkg-remove-auto.xpm"
-#include "icons/pkg-3D.xpm"
// bridge as we don't want to mix c++ class polymorphism and gobject
struct YGtkZyppModel::PoolNotify : public Ypp::Pool::Listener {
@@ -36,8 +35,7 @@
struct PackageIcons {
GdkPixbuf *installed, *installed_upgradable, *installed_locked,
*installed_upgradable_locked, *available, *available_locked,
- *to_install, *to_remove, *to_auto_install, *to_auto_remove,
- *is_3D;
+ *to_install, *to_remove, *to_auto_install, *to_auto_remove;
PackageIcons() {
installed = gdk_pixbuf_new_from_xpm_data (pkg_installed_xpm);
installed_upgradable =
@@ -51,7 +49,6 @@
to_remove = gdk_pixbuf_new_from_xpm_data (pkg_remove_xpm);
to_auto_install = gdk_pixbuf_new_from_xpm_data (pkg_install_auto_xpm);
to_auto_remove = gdk_pixbuf_new_from_xpm_data (pkg_remove_auto_xpm);
- is_3D = gdk_pixbuf_new_from_xpm_data (pkg_3D_xpm);
}
~PackageIcons() {
g_object_unref (G_OBJECT (installed));
@@ -64,7 +61,6 @@
g_object_unref (G_OBJECT (to_remove));
g_object_unref (G_OBJECT (to_auto_install));
g_object_unref (G_OBJECT (to_auto_remove));
- g_object_unref (G_OBJECT (is_3D));
}
};
@@ -115,7 +111,6 @@
{
YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
int row = zmodel->pool->getIndex (iter->user_data);
-fprintf (stderr, "get index: %d\n", row);
GtkTreePath *path = gtk_tree_path_new();
gtk_tree_path_append_index (path, row);
@@ -140,13 +135,10 @@
void ygtk_zypp_model_entry_inserted (YGtkZyppModel *model, Ypp::Pool::Iter it)
{
-fprintf (stderr, "inserted row\n");
GtkTreeIter iter;
iter.user_data = it;
GtkTreePath *path = ygtk_zypp_model_get_path (GTK_TREE_MODEL (model), &iter);
-fprintf (stderr, "signal\n");
gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), path, &iter);
-fprintf (stderr, "done\n");
gtk_tree_path_free (path);
}
@@ -175,8 +167,6 @@
return G_TYPE_STRING;
case YGtkZyppModel::PTR_COLUMN:
return G_TYPE_POINTER;
- case YGtkZyppModel::SPECIAL_ICON_COLUMN:
- return GDK_TYPE_PIXBUF;
}
return 0;
}
@@ -257,14 +247,6 @@
g_value_set_pointer (value, ptr);
break;
}
- case YGtkZyppModel::SPECIAL_ICON_COLUMN:
- {
- if (package->is3D())
- g_value_set_object (value, (GObject *) icons->is_3D);
- else
- g_value_set_object (value, NULL);
- break;
- }
default:
g_warning ("YGtkZyppModel column %d doesn't exist.", column);
break;
Modified: trunk/gtk/src/ygtkzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppwrapper.h?rev=43…
==============================================================================
--- trunk/gtk/src/ygtkzyppwrapper.h (original)
+++ trunk/gtk/src/ygtkzyppwrapper.h Thu Dec 20 21:44:06 2007
@@ -26,8 +26,7 @@
GObject parent;
enum Columns {
- ICON_COLUMN, NAME_COLUMN, NAME_DESCRIPTION_COLUMN, PTR_COLUMN,
- SPECIAL_ICON_COLUMN, TOTAL_COLUMNS
+ ICON_COLUMN, NAME_COLUMN, NAME_DESCRIPTION_COLUMN, PTR_COLUMN, TOTAL_COLUMNS
};
Ypp::Pool *pool;
Modified: trunk/gtk/src/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=4321…
==============================================================================
--- trunk/gtk/src/yzyppwrapper.cc (original)
+++ trunk/gtk/src/yzyppwrapper.cc Thu Dec 20 21:44:06 2007
@@ -156,7 +156,7 @@
private:
bool resolveProblems();
- Node *addCategory (Package::Type type, const std::string &str, Package *package);
+ Node *addCategory (Ypp::Package::Type type, const std::string &str);
void polishCategories (Ypp::Package::Type type);
void startTransactions();
@@ -177,8 +177,9 @@
struct Ypp::Package::Impl
{
- Impl (ZyppSelectable sel)
- : zyppSel (sel), index (-1), availableVersions (NULL), installedVersion (NULL), is3D (false)
+ Impl (Type type, ZyppSelectable sel, Node *category)
+ : type (type), zyppSel (sel), category (category),
+ availableVersions (NULL), installedVersion (NULL)
{
// don't use getAvailableVersion(0) for hasUpgrade() has its inneficient.
// let's just cache candidate() at start, which should point to the newest version.
@@ -204,14 +205,12 @@
{ curStatus = zyppSel->status(); }
std::string name, summary;
- ZyppSelectable zyppSel;
- int index; // used for Pools syncing
Type type;
+ ZyppSelectable zyppSel;
Ypp::Node *category;
GSList *availableVersions;
Version *installedVersion;
bool hasUpgrade;
- bool is3D;
zypp::ui::Status curStatus; // so we know if resolver touched it
};
@@ -233,10 +232,13 @@
switch (impl->type) {
case PATTERN_TYPE:
ret = obj->summary();
+ break;
case LANGUAGE_TYPE:
ret = obj->description();
+ break;
default:
ret = sel->name();
+ break;
}
}
return ret;
@@ -274,11 +276,15 @@
ZyppPackage package = tryCastToZyppPkg (object);
std::string url = package->url(), license = package->license();
if (!url.empty())
- text += br + _("Website: ") + url;
+ text += br + "<b>" + _("Website: ") + "</b>" + url;
if (!license.empty())
- text += br + _("License: ") + license;
+ text += br + "<b>" + _("License: ") + "</b>" + license;
+ }
+ else if (impl->type == PATCH_TYPE) {
+
}
- text += br + _("Size: ") + object->size().asString();
+ if (impl->type != PATCH_TYPE)
+ text += br + "<b>" + _("Size: ") + "</b>" + object->size().asString();
return text;
}
@@ -367,7 +373,6 @@
std::string Ypp::Package::authors()
{
-fprintf (stderr, "authors %s\n", name().c_str());
std::string text;
ZyppObject object = impl->zyppSel->theObj();
ZyppPackage package = tryCastToZyppPkg (object);
@@ -382,7 +387,6 @@
if (!authors.empty())
authors += "<br>";
authors += author;
-fprintf (stderr, "\t add author %s\n", author.c_str());
}
// Some packagers put Authors over the Descriptions field. This seems to be rare
// on, so I'm not even going to bother.
@@ -428,14 +432,53 @@
return impl->category;
}
-bool Ypp::Package::is3D()
+bool Ypp::Package::fromCollection (Ypp::Package *collection)
{
- return impl->is3D;
+ switch (collection->type()) {
+ case Ypp::Package::PATTERN_TYPE:
+ {
+ ZyppSelectable selectable = collection->impl->zyppSel;
+ ZyppObject object = selectable->theObj();
+ ZyppPattern pattern = tryCastToZyppPattern (object);
+
+ const set <string> &packages = pattern->install_packages();
+ for (set <string>::iterator it = packages.begin();
+ it != packages.end(); it++) {
+ if (this->impl->zyppSel->name() == *it)
+ return true;
+ }
+ break;
+ }
+ case Ypp::Package::LANGUAGE_TYPE:
+ {
+ ZyppSelectable selectable = collection->impl->zyppSel;
+ ZyppObject object = selectable->theObj();
+ ZyppLanguage language = tryCastToZyppLanguage (object);
+
+ ZyppObject pkgobj = this->impl->zyppSel->theObj();
+ const zypp::CapSet &capSet = pkgobj->dep (zypp::Dep::FRESHENS);
+ for (zypp::CapSet::const_iterator it = capSet.begin();
+ it != capSet.end(); it++) {
+ if (it->index() == language->name())
+ return true;
+ }
+ }
+ default:
+ break;
+ }
+ return false;
}
-
bool Ypp::Package::isInstalled()
{
+ if (impl->type == Ypp::Package::PATCH_TYPE) {
+ if (impl->zyppSel->hasInstalledObj()) {
+ // broken? show as available
+ if (impl->zyppSel->installedPoolItem().status().isIncomplete())
+ return false;
+ }
+ }
+
return impl->zyppSel->hasInstalledObj();
}
@@ -703,6 +746,7 @@
Key <bool> hasUpgrade;
Key <bool> isModified;
Key <std::list <int> > onRepositories;
+ Key <Ypp::Package *> onCollection;
Impl()
{}
@@ -731,6 +775,8 @@
}
}
}
+ if (match && onCollection.defined)
+ match = package->fromCollection (onCollection.value);
if (match && category.defined) {
Ypp::Node *query_category = category.value;
Ypp::Node *pkg_category = package->category();
@@ -750,14 +796,13 @@
}
};
-Ypp::Query::Query (Ypp::Package::Type type)
-{
- impl = new Impl();
- impl->type.define (type);
-}
+Ypp::Query::Query()
+{ impl = new Impl(); }
Ypp::Query::~Query()
{ delete impl; }
+void Ypp::Query::setType (Ypp::Package::Type value)
+{ impl->type.define (value); }
void Ypp::Query::setName (std::string value)
{ impl->name.define (YGUtils::splitString (value, ' ')); }
void Ypp::Query::setCategory (Ypp::Node *value)
@@ -770,6 +815,8 @@
{ impl->isModified.define (value); }
void Ypp::Query::setRepositories (std::list <int> value)
{ impl->onRepositories.define (value); }
+void Ypp::Query::setCollection (Ypp::Package *value)
+{ impl->onCollection.define (value); }
//** Pool
@@ -783,13 +830,11 @@
: query (query), listener (NULL)
{
packages = buildPool (query);
-fprintf (stderr, "created pool, adding to Ypp\n");
ypp->impl->addPool (this);
}
~Impl()
{
-fprintf (stderr, "destroyed pool, removing from Ypp\n");
ypp->impl->removePool (this);
delete query;
g_slist_free (packages);
@@ -798,31 +843,24 @@
void packageModified (Package *package)
{
bool match = query->impl->match (package);
- int cmp = 1;
GSList *i;
for (i = packages; i; i = i->next) {
- Package *pkg = (Package *) i->data;
- if (pkg->impl->index == package->impl->index)
- cmp = 0;
- if (pkg->impl->index >= package->impl->index)
+ if (package == i->data)
break;
}
- if (cmp == 0) {
+ if (i) { // is on pool
if (match) { // modified
-fprintf (stderr, "pool (%d) - touched: %s\n", g_slist_length (packages), package->name().c_str());
if (listener)
listener->entryChanged ((Iter) i, package);
}
else { // removed
-fprintf (stderr, "pool (%d) - remove: %s\n", g_slist_length (packages), package->name().c_str());
if (listener)
listener->entryDeleted ((Iter) i, package);
packages = g_slist_delete_link (packages, i);
}
}
- else {
+ else { // not on pool
if (match) { // inserted
-fprintf (stderr, "pool (%d) - insert: %s\n", g_slist_length (packages), package->name().c_str());
if (i == NULL) {
packages = g_slist_append (packages, (gpointer) package);
i = g_slist_last (packages);
@@ -841,19 +879,17 @@
private:
static GSList *buildPool (Query *query) // at construction
{
-long time1 = time(NULL);
-fprintf (stderr, "build pool...\n");
GSList *pool = NULL;
- GSList *entire_pool = ypp->impl->getPackages (query->impl->type.value);
- int index = 0;
- for (GSList *i = entire_pool; i; i = i->next) {
- Package *pkg = (Package *) i->data;
- if (query->impl->match (pkg))
- pool = g_slist_append (pool, i->data);
- if (pkg->impl->index == -1)
- pkg->impl->index = index++;
+ for (int t = 0; t < Ypp::Package::TOTAL_TYPES; t++) {
+ if (!query->impl->type.is ((Ypp::Package::Type) t))
+ continue;
+ GSList *entire_pool = ypp->impl->getPackages ((Ypp::Package::Type) t);
+ for (GSList *i = entire_pool; i; i = i->next) {
+ Package *pkg = (Package *) i->data;
+ if (query->impl->match (pkg))
+ pool = g_slist_append (pool, i->data);
+ }
}
-fprintf (stderr, "delta time: %ld\n", time(NULL)-time1);
return pool;
}
};
@@ -956,6 +992,8 @@
Ypp::Node *Ypp::getFirstCategory (Ypp::Package::Type type)
{
+ if (!impl->getPackages (type))
+ return NULL;
return impl->categories[type]->getFirst();
}
@@ -973,54 +1011,7 @@
return NULL;
}
-struct CatConversor {
- const char *from, *to;
-};
-static const CatConversor catConversor[] = {
- { "Amusements/Games/3D", "Games/Action" },
- { "Amusements/Games/Board/Puzzle", "Games/Logic" },
- { "Amusements/Games/Board/Card", "Games/Card" },
- { "Amusements/Games", "Games" },
- { "Amusements", "Games" },
- { "Applications/Publishing", "Office" },
- { "Applications/Internet", "Network" },
- { "Applications", "" },
- { "Development/C", "Development/Libraries/C and C++" },
- { "Development/Python", "Development/Libraries/Python" },
- { "Development/Libraries/C", "Development/Libraries/C and C++" },
- { "Libraries", "Development/Libraries" },
- { "Productivity/Multimedia/Player", "Multimedia/Sound/Players" },
- { "Productivity/Multimedia/Audio", "Multimedia/Sound/Players" },
- { "Video", "Multimedia/Video" },
- { "Productivity/Multimedia", "Multimedia" },
- { "Productivity/Graphics", "Multimedia/Graphics" },
- { "Productivity/Networking", "Network" },
- { "Productivity/Network", "Network" },
- { "Productivity/Office", "Office" },
- { "Productivity/Publishing", "Office/Publishing" },
- { "Productivity/Telephony", "Network/Telephony" },
- { "Productivity", "Utilities" },
- { "System/Emulators", "Emulators" },
- { "System/GUI", "Utilities/GUI" },
- { "System/Video", "Emulators" },
- { "System/Libraries", "Development/Libraries/C and C++/System" },
- { "X11/Applications/Multimedia", "Multimedia" },
- { "X11/GNOME/Multimedia", "Multimedia" },
- { "X11/Applications", "Utilities/GUI" },
-};
-#define CAT_CONVERSOR_SIZE (sizeof (catConversor)/sizeof (CatConversor))
-struct TypoConversor {
- const char *from, *to, len;
-};
-static const TypoConversor catTypos[] = {
- { "Others", "Other", 6 }, { "Utilites", "Utilities", 8 },
- { "AOLInstantMessenge", "AOLInstantMessenger", 18 },
- { "Library", "Libraries", 7 }, { "Libs", "Libraries", 4 },
-};
-#define CAT_TYPOS_SIZE (sizeof (catTypos)/sizeof (TypoConversor))
-
-Ypp::Node *Ypp::Impl::addCategory (Ypp::Package::Type type,
- const std::string &category_str, Package *pkg)
+Ypp::Node *Ypp::Impl::addCategory (Ypp::Package::Type type, const std::string &category_str)
{
struct inner {
static int cmp (const char *a, const char *b)
@@ -1032,59 +1023,17 @@
return -1;
return YGUtils::strcmp (a, b);
}
-
- // Package categories guide-line don't seem to be enforced, some categories
- // are duplicated, or don't make much sense. Let's try to cut on that.
-
- static std::string treatCategory (const std::string &category, Package *pkg)
- {
- std::string ret (category);
-
- // typos (end group only)
- for (unsigned int c = 0; c < CAT_TYPOS_SIZE; c++) {
- const char *from = catTypos[c].from, from_len = catTypos[c].len;
- int ret_index = ret.length() - from_len;
-
- if (ret_index >= 0 && ret.compare (ret_index, from_len, from, from_len) == 0) {
- const char *to = catTypos[c].to;
- ret.erase (ret_index);
- ret.append (to);
- break;
- }
- }
-
- for (unsigned int c = 0; c < CAT_CONVERSOR_SIZE; c++) {
- const char *from = catConversor[c].from;
- unsigned int i;
- for (i = 0; from[i] && i < ret.length(); i++)
- if (from[i] != ret[i])
- break;
- if (!from[i] && (i == ret.length() || ret[i] == '/')) {
- const char *to = catConversor[c].to;
- ret.erase (0, i);
- ret.insert (0, to);
- if (c == 0 && pkg)
- pkg->impl->is3D = true;
- break;
- }
- }
- return ret;
- }
};
if (!categories[type])
categories[type] = new StringTree (inner::cmp, '/');
- if (type == Package::PACKAGE_TYPE)
- return categories[type]->add (inner::treatCategory (category_str, pkg));
- else
- return categories[type]->add (category_str);
+ return categories[type]->add (category_str);
}
void Ypp::Impl::polishCategories (Ypp::Package::Type type)
{
// some treatment on categories
- // Put all packages under a node (as opposite to packages on a leaf) to
- // the Other category.
+ // Packages must be on leaves. If not, create a "Other" leaf, and put it there.
if (type == Package::PACKAGE_TYPE) {
GSList *pool = ypp->impl->getPackages (type);
for (GSList *i = pool; i; i = i->next) {
@@ -1097,7 +1046,6 @@
pkg->impl->category = (Ypp::Node *) last->data;
else {
// must create a "Other" node
- fprintf (stderr, "creating Other\n");
Ypp::Node *yN = new Ypp::Node();
GNode *n = g_node_new ((void *) yN);
yN->name = "Other";
@@ -1229,20 +1177,21 @@
resolved = interface->resolveProblems (problems);
- zypp::ProblemSolutionList choices;
- for (std::list <Problem *>::iterator it = problems.begin();
- it != problems.end(); it++) {
- for (int i = 0; (*it)->getSolution (i); i++) {
- Problem::Solution *solution = (*it)->getSolution (i);
- if (resolved && solution->apply)
- choices.push_back ((zypp::ProblemSolution *) solution->impl);
- delete solution;
+ if (resolved) {
+ zypp::ProblemSolutionList choices;
+ for (std::list <Problem *>::iterator it = problems.begin();
+ it != problems.end(); it++) {
+ for (int i = 0; (*it)->getSolution (i); i++) {
+ Problem::Solution *solution = (*it)->getSolution (i);
+ if (resolved && solution->apply)
+ choices.push_back ((zypp::ProblemSolution *) solution->impl);
+ delete solution;
+ }
+ delete *it;
}
- delete *it;
- }
- if (resolved)
zResolver->applySolutions (choices);
+ }
else
break;
}
@@ -1255,16 +1204,15 @@
void Ypp::Impl::packageModified (Ypp::Package *package)
{
// notify listeners of package change
- for (GSList *i = pools; i; i = i->next) {
-fprintf (stderr, "ypp: informing pool of package modified\n");
+ for (GSList *i = pools; i; i = i->next)
((Pool::Impl *) i->data)->packageModified (package);
- }
if (disk)
disk->impl->packageModified (package);
if (interface)
interface->packageModified (package);
- transactions = g_slist_append (transactions, package);
+ if (!g_slist_find (transactions, package)) /* could be a result of undo */
+ transactions = g_slist_append (transactions, package);
if (!inTransaction)
finishTransactions();
}
@@ -1300,79 +1248,13 @@
}
void Ypp::Impl::addPool (Pool::Impl *pool)
-{ fprintf (stderr, "ypp: adding pool\n"); pools = g_slist_append (pools, pool); }
+{ pools = g_slist_append (pools, pool); }
void Ypp::Impl::removePool (Pool::Impl *pool)
-{ fprintf (stderr, "ypp: removing pool\n"); pools = g_slist_remove (pools, pool); }
-
-#if 0
-// using auxiliary GSequence tree -- not yet shiped by Glib :X
-// in any case, a sort merge is very fast, as packages are more or less
-// sorted anyway...
-GSList *Ypp::Impl::getPackages (Ypp::Package::Type type)
-{
- if (!packages[type]) {
- // auxiliary for efficient alphabetic sorting
- GSequence *pool = g_sequence_new (NULL);
- struct inner {
- static gint compare (gconstpointer _a, gconstpointer _b, gpointer _data)
- {
- Package *a = (Package *) _a;
- Package *b = (Package *) _b;
- return YGUtils::strcmp (a->name().c_str(), b->name().c_str());
- }
-/* static void pool_foreach (gpointer data, gpointer _list)
- {
- GSList **list = (GSList **) _list;
- *list = g_slist_append (*list, data);
- }*/
- };
-
- ZyppPool::const_iterator it, end;
- switch (type)
- {
- case Package::PACKAGE_TYPE:
- it = zyppPool().byKindBegin <zypp::Package>();
- end = zyppPool().byKindEnd <zypp::Package>();
- break;
- case Package::PATTERN_TYPE:
- it = zyppPool().byKindBegin <zypp::Pattern>();
- end = zyppPool().byKindEnd <zypp::Pattern>();
- break;
- case Package::LANGUAGE_TYPE:
- it = zyppPool().byKindBegin <zypp::Language>();
- end = zyppPool().byKindEnd <zypp::Language>();
- break;
- default:
- break;
- }
- for (; it != end; it++)
- {
- Package *package = new Package (new Package::Impl (*it));
- g_sequence_insert_sorted (pool, package, inner::compare, NULL);
- }
-
- // add stuff to the actual pool now
- int index = 0;
- for (GSequenceIter *it = g_sequence_get_begin_iter (pool);
- !g_sequence_iter_is_end (it); it = g_sequence_iter_next (it)) {
- gpointer data = g_sequence_get (it);
- Package *pkg = (Package *) data;
- pkg->impl->index = index++;
- pkg->impl->type = type;
- packages[type] = g_slist_append (packages[type], data);
- }
+{ pools = g_slist_remove (pools, pool); }
-// g_sequence_foreach (pool, inner::pool_foreach, &);
- g_sequence_free (pool);
- }
- return packages[type];
-}
-#else
GSList *Ypp::Impl::getPackages (Ypp::Package::Type type)
{
if (!packages[type]) {
-long time1 = time(NULL);
-fprintf (stderr, "creating pool of %d...\n", type);
GSList *pool = NULL;
struct inner {
static gint compare (gconstpointer _a, gconstpointer _b)
@@ -1397,29 +1279,50 @@
it = zyppPool().byKindBegin <zypp::Language>();
end = zyppPool().byKindEnd <zypp::Language>();
break;
+ case Package::PATCH_TYPE:
+ it = zyppPool().byKindBegin <zypp::Patch>();
+ end = zyppPool().byKindEnd <zypp::Patch>();
+ break;
default:
break;
}
for (; it != end; it++) {
- Package *package = new Package (new Package::Impl (*it));
Ypp::Node *category = 0;
- if (type == Package::PACKAGE_TYPE) {
- ZyppObject object = (*it)->theObj();
- ZyppPackage zpackage = tryCastToZyppPkg (object);
- if (!zpackage)
- continue;
- category = addCategory (type, zpackage->group(), package);
- }
- else if (type == Package::PATTERN_TYPE) {
- ZyppObject object = (*it)->theObj();
- ZyppPattern pattern = tryCastToZyppPattern (object);
- if (!pattern || !pattern->userVisible())
- continue;
- category = addCategory (type, pattern->category(), 0);
+ ZyppObject object = (*it)->theObj();
+ // add category and test visibility
+ switch (type) {
+ case Package::PACKAGE_TYPE:
+ {
+ ZyppPackage zpackage = tryCastToZyppPkg (object);
+ if (!zpackage)
+ continue;
+ category = addCategory (type, zpackage->group());
+ break;
+ }
+ case Package::PATTERN_TYPE:
+ {
+ ZyppPattern pattern = tryCastToZyppPattern (object);
+ if (!pattern || !pattern->userVisible())
+ continue;
+ category = addCategory (type, pattern->category());
+ break;
+ }
+ case Package::PATCH_TYPE:
+ {
+ ZyppPatch patch = tryCastToZyppPatch (object);
+ if (!patch)
+ continue;
+ if (!(*it)->hasInstalledObj())
+ if (!(*it)->hasCandidateObj() || !(*it)->candidatePoolItem().status().isNeeded())
+ continue;
+ category = addCategory (type, patch->category());
+ break;
+ }
+ default:
+ break;
}
- package->impl->type = type;
- package->impl->category = category;
+ Package *package = new Package (new Package::Impl (type, *it, category));
pool = g_slist_prepend (pool, package);
}
// its faster to prepend then reverse, as we avoid iterating for each append
@@ -1430,11 +1333,9 @@
packages[type] = pool;
polishCategories (type);
-fprintf (stderr, "delta time: %ld\n", time(NULL)-time1);
}
return packages[type];
}
-#endif
Ypp::Ypp()
{
Modified: trunk/gtk/src/yzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.h?rev=43216…
==============================================================================
--- trunk/gtk/src/yzyppwrapper.h (original)
+++ trunk/gtk/src/yzyppwrapper.h Thu Dec 20 21:44:06 2007
@@ -38,14 +38,14 @@
// Entries
struct Package {
enum Type {
- PACKAGE_TYPE, PATTERN_TYPE, LANGUAGE_TYPE, TOTAL_TYPES
+ PACKAGE_TYPE, PATTERN_TYPE, LANGUAGE_TYPE, PATCH_TYPE, TOTAL_TYPES
};
Type type();
const std::string &name();
const std::string &summary();
Node *category();
- bool is3D();
+ bool fromCollection (Ypp::Package *package);
std::string description();
std::string filelist();
@@ -93,13 +93,15 @@
// Query
struct Query {
- Query (Package::Type type);
+ Query();
+ void setType (Package::Type type);
void setName (std::string name);
void setCategory (Ypp::Node *category);
void setIsInstalled (bool installed);
void setHasUpgrade (bool upgradable);
void setIsModified (bool modified);
void setRepositories (std::list <int> repositories);
+ void setCollection (Ypp::Package *package);
~Query();
struct Impl;
@@ -118,9 +120,9 @@
Iter getIter (int index);
struct Listener {
- virtual void entryChanged (Iter iter, Package *package) = 0;
virtual void entryInserted (Iter iter, Package *package) = 0;
virtual void entryDeleted (Iter iter, Package *package) = 0;
+ virtual void entryChanged (Iter iter, Package *package) = 0;
};
void setListener (Listener *listener);
--
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] r43215 - in /trunk/gtk: unstable-libyui/ unstable/
by rpmcruz@svn.opensuse.org 20 Dec '07
by rpmcruz@svn.opensuse.org 20 Dec '07
20 Dec '07
Author: rpmcruz
Date: Thu Dec 20 21:39:52 2007
New Revision: 43215
URL: http://svn.opensuse.org/viewcvs/yast?rev=43215&view=rev
Log:
Moving unstable-libyui to main.
Removed:
trunk/gtk/unstable/
trunk/gtk/unstable-libyui/
--
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] r43214 - in /trunk/gtk/src: ygtkimage.c ygtkimage.h ygtkzyppwrapper.cc ygtkzyppwrapper.h yzyppwrapper.cc yzyppwrapper.h
by rpmcruz@svn.opensuse.org 20 Dec '07
by rpmcruz@svn.opensuse.org 20 Dec '07
20 Dec '07
Author: rpmcruz
Date: Thu Dec 20 21:38:55 2007
New Revision: 43214
URL: http://svn.opensuse.org/viewcvs/yast?rev=43214&view=rev
Log:
Moving unstable-libyui to main.
Added:
trunk/gtk/src/ygtkimage.c
trunk/gtk/src/ygtkimage.h
trunk/gtk/src/ygtkzyppwrapper.cc
trunk/gtk/src/ygtkzyppwrapper.h
trunk/gtk/src/yzyppwrapper.cc
trunk/gtk/src/yzyppwrapper.h
Added: trunk/gtk/src/ygtkimage.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkimage.c?rev=43214&vi…
==============================================================================
--- trunk/gtk/src/ygtkimage.c (added)
+++ trunk/gtk/src/ygtkimage.c Thu Dec 20 21:38:55 2007
@@ -0,0 +1,285 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkImage widget */
+// check the header file for information about this widget
+
+#include <config.h>
+#include "ygdkmngloader.h"
+#include "ygtkimage.h"
+#include <gtk/gtkiconfactory.h>
+
+G_DEFINE_TYPE (YGtkImage, ygtk_image, GTK_TYPE_DRAWING_AREA)
+
+static void ygtk_image_init (YGtkImage *image)
+{
+}
+
+static void ygtk_image_free_pixbuf (YGtkImage *image)
+{
+ if (image->animated) {
+ if (image->animation) {
+ g_object_unref (G_OBJECT (image->animation->pixbuf));
+ if (image->animation->timeout_id)
+ g_source_remove (image->animation->timeout_id);
+ g_free (image->animation);
+ image->animation = NULL;
+ }
+ }
+ else {
+ if (image->pixbuf) {
+ g_object_unref (G_OBJECT (image->pixbuf));
+ image->pixbuf = NULL;
+ }
+ }
+}
+
+static void ygtk_image_destroy (GtkObject *object)
+{
+ YGtkImage *image = YGTK_IMAGE (object);
+ if (image->alt_text)
+ g_free (image->alt_text);
+ image->alt_text = NULL;
+ ygtk_image_free_pixbuf (image);
+ GTK_OBJECT_CLASS (ygtk_image_parent_class)->destroy (object);
+}
+
+static void ygtk_image_set_pixbuf (YGtkImage *image, GdkPixbuf *pixbuf, const char *error_msg)
+{
+ ygtk_image_free_pixbuf (image);
+ gtk_widget_queue_resize (GTK_WIDGET (image));
+
+ if (pixbuf) {
+ image->animated = FALSE;
+ image->pixbuf = pixbuf;
+ image->loaded = TRUE;
+ }
+/* else
+ g_warning ("Couldn't load image - %s", error_msg);*/
+}
+
+static gboolean ygtk_image_advance_frame_cb (gpointer data)
+{
+ YGtkImage *image = (YGtkImage *) data;
+ struct _YGtkImageAnimation *animation = image->animation;
+
+ if (!animation->frame) // no frame yet loaded
+ animation->frame = gdk_pixbuf_animation_get_iter (animation->pixbuf, NULL);
+ else
+ if (gdk_pixbuf_animation_iter_advance (animation->frame, NULL))
+ gtk_widget_queue_draw (GTK_WIDGET (image));
+
+ // shedule next frame
+ int delay = gdk_pixbuf_animation_iter_get_delay_time (animation->frame);
+ if (delay != -1)
+ animation->timeout_id = g_timeout_add (delay, ygtk_image_advance_frame_cb, data);
+ return FALSE;
+}
+
+static void ygtk_image_set_animation (YGtkImage *image, GdkPixbufAnimation *pixbuf,
+ const char *error_msg)
+{
+ ygtk_image_free_pixbuf (image);
+ gtk_widget_queue_resize (GTK_WIDGET (image));
+
+ if (pixbuf) {
+ image->animated = TRUE;
+ image->animation = g_new0 (struct _YGtkImageAnimation, 1);
+ image->animation->pixbuf = pixbuf;
+ image->loaded = TRUE;
+ ygtk_image_advance_frame_cb (image);
+ }
+/* else
+ g_warning ("Couldn't load image - %s", error_msg);*/
+}
+
+void ygtk_image_set_from_file (YGtkImage *image, const char *filename, gboolean anim)
+{
+ GError *error = 0;
+ if (anim) {
+ GdkPixbufAnimation *pixbuf;
+ if (ygdk_mng_pixbuf_is_file_mng (filename))
+ pixbuf = ygdk_mng_pixbuf_new_from_file (filename, &error);
+ else
+ pixbuf = gdk_pixbuf_animation_new_from_file (filename, &error);
+ ygtk_image_set_animation (image, pixbuf, error ? error->message : "(undefined)");
+ }
+ else {
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, &error);
+ ygtk_image_set_pixbuf (image, pixbuf, error ? error->message : "(undefined)");
+ }
+}
+
+static void ygtk_image_loaded_cb (GdkPixbufLoader *loader, YGtkImage *image)
+{
+ if (image->animated) {
+ if (image->animation) {
+ // a new frame loaded -- just redraw the widget
+ if (gdk_pixbuf_animation_iter_on_currently_loading_frame
+ (image->animation->frame))
+ gtk_widget_queue_draw (GTK_WIDGET (image));
+ }
+ else {
+ GdkPixbufAnimation *pixbuf = gdk_pixbuf_loader_get_animation (loader);
+ g_object_ref (G_OBJECT (pixbuf));
+ ygtk_image_set_animation (image, pixbuf, "on block data reading callback");
+ }
+ }
+ else {
+ GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+ g_object_ref (G_OBJECT (pixbuf));
+ ygtk_image_set_pixbuf (image, pixbuf, "on block data reading callback");
+ }
+}
+
+void ygtk_image_set_from_data (YGtkImage *image, const guint8 *data, long data_size, gboolean anim)
+{
+ GError *error = 0;
+ if (anim && ygdk_mng_pixbuf_is_data_mng (data, data_size)) {
+ GdkPixbufAnimation *pixbuf;
+ pixbuf = ygdk_mng_pixbuf_new_from_data (data, data_size, &error);
+ ygtk_image_set_animation (image, pixbuf, error ? error->message : "(undefined)");
+ }
+ else {
+ image->animated = anim;
+ GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
+ g_signal_connect (G_OBJECT (loader), "area-prepared",
+ G_CALLBACK (ygtk_image_loaded_cb), image);
+ if (!gdk_pixbuf_loader_write (loader, data, data_size, &error))
+ g_warning ("Could not load image from data blocks: %s", error->message);
+ gdk_pixbuf_loader_close (loader, &error);
+ }
+}
+
+void ygtk_image_set_props (YGtkImage *image, YGtkImageAlign align, const gchar *alt_text)
+{
+ image->align = align;
+ if (image->alt_text)
+ g_free (image->alt_text);
+ image->alt_text = g_strdup (alt_text);
+ gtk_widget_queue_draw (GTK_WIDGET (image));
+}
+
+static void ygtk_image_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+ YGtkImage *image = YGTK_IMAGE (widget);
+ int width = 0, height = 0;
+ if (image->loaded) {
+ if (image->animated) {
+ width = gdk_pixbuf_animation_get_width (image->animation->pixbuf);
+ height = gdk_pixbuf_animation_get_height (image->animation->pixbuf);
+ }
+ else {
+ width = gdk_pixbuf_get_width (image->pixbuf);
+ height = gdk_pixbuf_get_height (image->pixbuf);
+ }
+ }
+ else if (image->alt_text) {
+ PangoLayout *layout;
+ layout = gtk_widget_create_pango_layout (widget, image->alt_text);
+ pango_layout_get_pixel_size (layout, &width, &height);
+ }
+ requisition->width = width;
+ requisition->height = height;
+}
+
+static GdkPixbuf *ygtk_image_render_state (GtkWidget *widget, GdkPixbuf *pixbuf)
+{
+ // as in GtkImage
+ GtkIconSource *source = gtk_icon_source_new();
+ GdkPixbuf *rendered;
+ gtk_icon_source_set_pixbuf (source, pixbuf);
+ gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_icon_source_set_size_wildcarded (source, FALSE);
+ rendered = gtk_style_render_icon (widget->style, source,
+ gtk_widget_get_direction (widget), GTK_WIDGET_STATE (widget),
+ /* arbitrary */ (GtkIconSize)-1, widget, "gtk-image");
+ gtk_icon_source_free (source);
+ return rendered;
+}
+
+static gboolean ygtk_image_expose_event (GtkWidget *widget, GdkEventExpose *event)
+{
+ YGtkImage *image = YGTK_IMAGE (widget);
+ int width, height;
+ width = widget->allocation.width;
+ height = widget->allocation.height;
+
+ cairo_t *cr = gdk_cairo_create (widget->window);
+
+ if (!image->loaded && image->alt_text) {
+ // show alt text if no image was loaded
+ PangoLayout *layout;
+ layout = gtk_widget_create_pango_layout (widget, image->alt_text);
+
+ int x, y;
+ x = (width - widget->requisition.width) / 2;
+ y = (height - widget->requisition.height) / 2;
+
+ cairo_move_to (cr, x, y);
+ pango_cairo_show_layout (cr, layout);
+
+ g_object_unref (layout);
+ cairo_destroy (cr);
+ return TRUE;
+ }
+
+ GdkPixbuf *pixbuf;
+ if (image->animated)
+ pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (image->animation->frame);
+ else
+ pixbuf = image->pixbuf;
+
+ gboolean needs_transform = GTK_WIDGET_STATE (widget) != GTK_STATE_NORMAL;
+ if (needs_transform)
+ pixbuf = ygtk_image_render_state (widget, pixbuf);
+ int x = 0, y = 0;
+ if (image->align == CENTER_IMAGE_ALIGN) {
+ x = (width - widget->requisition.width) / 2;
+ y = (height - widget->requisition.height) / 2;
+ }
+
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
+
+ switch (image->align) {
+ case CENTER_IMAGE_ALIGN:
+ break;
+ case SCALE_IMAGE_ALIGN:
+ {
+ double scale_x = (double) gdk_pixbuf_get_width (pixbuf) / width;
+ double scale_y = (double) gdk_pixbuf_get_height (pixbuf) / height;
+ cairo_matrix_t matrix;
+ cairo_matrix_init_scale (&matrix, scale_x, scale_y);
+ cairo_pattern_set_matrix (cairo_get_source (cr), &matrix);
+ break;
+ }
+ case TILE_IMAGE_ALIGN:
+ cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+ break;
+ }
+
+ cairo_rectangle (cr, x, y, width, height);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
+ if (needs_transform)
+ g_object_unref (G_OBJECT (pixbuf));
+ return FALSE;
+}
+
+GtkWidget* ygtk_image_new (void)
+{
+ return g_object_new (YGTK_TYPE_IMAGE, NULL);
+}
+
+static void ygtk_image_class_init (YGtkImageClass *klass)
+{
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->expose_event = ygtk_image_expose_event;
+ widget_class->size_request = ygtk_image_size_request;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_image_destroy;
+}
+
Added: trunk/gtk/src/ygtkimage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkimage.h?rev=43214&vi…
==============================================================================
--- trunk/gtk/src/ygtkimage.h (added)
+++ trunk/gtk/src/ygtkimage.h Thu Dec 20 21:38:55 2007
@@ -0,0 +1,75 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* GtkImage doesn't provide all the functionality asked by libyui,
+ such as scaling and tiling. Thus, YGtkImage is a more powerful
+ GtkImage.
+*/
+
+#ifndef YGTK_IMAGE_H
+#define YGTK_IMAGE_H
+
+#include <gtk/gtkdrawingarea.h>
+#include <gdk/gdkpixbuf.h>
+
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_IMAGE (ygtk_image_get_type ())
+#define YGTK_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_IMAGE, YGtkImage))
+#define YGTK_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_IMAGE, YGtkImageClass))
+#define YGTK_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_IMAGE))
+#define YGTK_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_IMAGE))
+#define YGTK_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_IMAGE, YGtkImageClass))
+
+typedef enum {
+ CENTER_IMAGE_ALIGN, SCALE_IMAGE_ALIGN, TILE_IMAGE_ALIGN
+} YGtkImageAlign;
+
+struct _YGtkImageAnimation {
+ GdkPixbufAnimation *pixbuf;
+ GdkPixbufAnimationIter *frame;
+ guint timeout_id;
+};
+
+typedef struct _YGtkImage
+{
+ GtkDrawingArea parent;
+
+ // properties:
+ YGtkImageAlign align;
+
+ gboolean animated;
+ union {
+ GdkPixbuf *pixbuf;
+ struct _YGtkImageAnimation *animation;
+ };
+
+ gboolean loaded;
+ gchar *alt_text;
+
+} YGtkImage;
+
+typedef struct _YGtkImageClass
+{
+ GtkDrawingAreaClass parent_class;
+} YGtkImageClass;
+
+GtkWidget* ygtk_image_new (void);
+GType ygtk_image_get_type (void) G_GNUC_CONST;
+
+void ygtk_image_set_from_file (YGtkImage *image, const char *filename, gboolean anim);
+void ygtk_image_set_from_data (YGtkImage *image, const guint8 *data, long size, gboolean anim);
+void ygtk_image_set_props (YGtkImage *image, YGtkImageAlign align, const gchar *alt_text);
+
+// as we don't have a window,
+
+G_END_DECLS
+
+#endif /* YGTK_IMAGE_H */
+
Added: trunk/gtk/src/ygtkzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppwrapper.cc?rev=4…
==============================================================================
--- trunk/gtk/src/ygtkzyppwrapper.cc (added)
+++ trunk/gtk/src/ygtkzyppwrapper.cc Thu Dec 20 21:38:55 2007
@@ -0,0 +1,333 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkZyppWrapper, gtk+ hooks for zypp wrapper */
+// check the header file for information about these hooks
+
+#include <config.h>
+#include "ygtkzyppwrapper.h"
+#include "YGUtils.h"
+
+#include "icons/pkg-installed.xpm"
+#include "icons/pkg-installed-upgradable.xpm"
+#include "icons/pkg-installed-upgradable-locked.xpm"
+#include "icons/pkg-installed-locked.xpm"
+#include "icons/pkg-available.xpm"
+#include "icons/pkg-available-locked.xpm"
+#include "icons/pkg-install.xpm"
+#include "icons/pkg-remove.xpm"
+#include "icons/pkg-install-auto.xpm"
+#include "icons/pkg-remove-auto.xpm"
+#include "icons/pkg-3D.xpm"
+
+// bridge as we don't want to mix c++ class polymorphism and gobject
+struct YGtkZyppModel::PoolNotify : public Ypp::Pool::Listener {
+YGtkZyppModel *model;
+ virtual void entryChanged (Ypp::Pool::Iter iter, Ypp::Package *package)
+ { ygtk_zypp_model_entry_changed (model, iter); }
+ virtual void entryInserted (Ypp::Pool::Iter iter, Ypp::Package *package)
+ { ygtk_zypp_model_entry_inserted (model, iter); }
+ virtual void entryDeleted (Ypp::Pool::Iter iter, Ypp::Package *package)
+ { ygtk_zypp_model_entry_deleted (model, iter); }
+};
+
+// Icons resources
+struct PackageIcons {
+ GdkPixbuf *installed, *installed_upgradable, *installed_locked,
+ *installed_upgradable_locked, *available, *available_locked,
+ *to_install, *to_remove, *to_auto_install, *to_auto_remove,
+ *is_3D;
+ PackageIcons() {
+ installed = gdk_pixbuf_new_from_xpm_data (pkg_installed_xpm);
+ installed_upgradable =
+ gdk_pixbuf_new_from_xpm_data (pkg_installed_upgradable_xpm);
+ installed_locked = gdk_pixbuf_new_from_xpm_data (pkg_installed_locked_xpm);
+ installed_upgradable_locked =
+ gdk_pixbuf_new_from_xpm_data (pkg_installed_upgradable_locked_xpm);
+ available = gdk_pixbuf_new_from_xpm_data (pkg_available_xpm);
+ available_locked = gdk_pixbuf_new_from_xpm_data (pkg_available_locked_xpm);
+ to_install = gdk_pixbuf_new_from_xpm_data (pkg_install_xpm);
+ to_remove = gdk_pixbuf_new_from_xpm_data (pkg_remove_xpm);
+ to_auto_install = gdk_pixbuf_new_from_xpm_data (pkg_install_auto_xpm);
+ to_auto_remove = gdk_pixbuf_new_from_xpm_data (pkg_remove_auto_xpm);
+ is_3D = gdk_pixbuf_new_from_xpm_data (pkg_3D_xpm);
+ }
+ ~PackageIcons() {
+ g_object_unref (G_OBJECT (installed));
+ g_object_unref (G_OBJECT (installed_upgradable));
+ g_object_unref (G_OBJECT (installed_upgradable_locked));
+ g_object_unref (G_OBJECT (installed_locked));
+ g_object_unref (G_OBJECT (available));
+ g_object_unref (G_OBJECT (available_locked));
+ g_object_unref (G_OBJECT (to_install));
+ g_object_unref (G_OBJECT (to_remove));
+ g_object_unref (G_OBJECT (to_auto_install));
+ g_object_unref (G_OBJECT (to_auto_remove));
+ g_object_unref (G_OBJECT (is_3D));
+ }
+};
+
+static PackageIcons *icons = NULL;
+void ygtk_zypp_model_finish()
+{
+ delete icons; icons = NULL;
+ Ypp::finish();
+}
+
+static void ygtk_zypp_model_tree_model_init (GtkTreeModelIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (YGtkZyppModel, ygtk_zypp_model, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, ygtk_zypp_model_tree_model_init))
+
+static void ygtk_zypp_model_init (YGtkZyppModel *zmodel)
+{
+ if (!icons)
+ icons = new PackageIcons();
+}
+
+static void ygtk_zypp_model_finalize (GObject *object)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (object);
+ delete zmodel->notify;
+ zmodel->notify = NULL;
+ delete zmodel->pool;
+ zmodel->pool = NULL;
+ G_OBJECT_CLASS (ygtk_zypp_model_parent_class)->finalize (object);
+}
+
+static GtkTreeModelFlags ygtk_zypp_model_get_flags (GtkTreeModel *)
+{
+ return GtkTreeModelFlags (GTK_TREE_MODEL_ITERS_PERSIST | GTK_TREE_MODEL_LIST_ONLY);
+}
+
+static gboolean ygtk_zypp_model_get_iter (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreePath *path)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ gint row = gtk_tree_path_get_indices (path)[0];
+
+ iter->user_data = (gpointer) zmodel->pool->getIter (row);
+ return iter->user_data != NULL;
+}
+
+static GtkTreePath *ygtk_zypp_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ int row = zmodel->pool->getIndex (iter->user_data);
+fprintf (stderr, "get index: %d\n", row);
+
+ GtkTreePath *path = gtk_tree_path_new();
+ gtk_tree_path_append_index (path, row);
+ return path;
+}
+
+static gboolean ygtk_zypp_model_iter_next (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ iter->user_data = zmodel->pool->getNext (iter->user_data);
+ return iter->user_data != NULL;
+}
+
+void ygtk_zypp_model_entry_changed (YGtkZyppModel *model, Ypp::Pool::Iter it)
+{
+ GtkTreeIter iter;
+ iter.user_data = it;
+ GtkTreePath *path = ygtk_zypp_model_get_path (GTK_TREE_MODEL (model), &iter);
+ gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
+ gtk_tree_path_free (path);
+}
+
+void ygtk_zypp_model_entry_inserted (YGtkZyppModel *model, Ypp::Pool::Iter it)
+{
+fprintf (stderr, "inserted row\n");
+ GtkTreeIter iter;
+ iter.user_data = it;
+ GtkTreePath *path = ygtk_zypp_model_get_path (GTK_TREE_MODEL (model), &iter);
+fprintf (stderr, "signal\n");
+ gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), path, &iter);
+fprintf (stderr, "done\n");
+ gtk_tree_path_free (path);
+}
+
+void ygtk_zypp_model_entry_deleted (YGtkZyppModel *model, Ypp::Pool::Iter it)
+{
+ GtkTreeIter iter;
+ iter.user_data = it;
+ GtkTreePath *path = ygtk_zypp_model_get_path (GTK_TREE_MODEL (model), &iter);
+ gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
+ gtk_tree_path_free (path);
+}
+
+static gint ygtk_zypp_model_get_n_columns (GtkTreeModel *model)
+{
+ return YGtkZyppModel::TOTAL_COLUMNS;
+}
+
+static GType ygtk_zypp_model_get_column_type (GtkTreeModel *tree_model, gint column)
+{
+ switch (column)
+ {
+ case YGtkZyppModel::ICON_COLUMN:
+ return GDK_TYPE_PIXBUF;
+ case YGtkZyppModel::NAME_COLUMN:
+ case YGtkZyppModel::NAME_DESCRIPTION_COLUMN:
+ return G_TYPE_STRING;
+ case YGtkZyppModel::PTR_COLUMN:
+ return G_TYPE_POINTER;
+ case YGtkZyppModel::SPECIAL_ICON_COLUMN:
+ return GDK_TYPE_PIXBUF;
+ }
+ return 0;
+}
+
+static void ygtk_zypp_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
+ gint column, GValue *value)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ Ypp::Package *package = zmodel->pool->get (iter->user_data);
+
+ g_value_init (value, ygtk_zypp_model_get_column_type (model, column));
+ switch (column)
+ {
+ case YGtkZyppModel::ICON_COLUMN:
+ {
+ GdkPixbuf *pixbuf;
+ bool locked = package->isLocked();
+ bool auto_ = package->isAuto();
+ if (package->toInstall()) {
+ if (auto_)
+ pixbuf = icons->to_auto_install;
+ else
+ pixbuf = icons->to_install;
+ }
+ else if (package->toRemove()) {
+ if (auto_)
+ pixbuf = icons->to_auto_remove;
+ else
+ pixbuf = icons->to_remove;
+ }
+ else if (package->hasUpgrade()) {
+ if (locked)
+ pixbuf = icons->installed_upgradable_locked;
+ else
+ pixbuf = icons->installed_upgradable;
+ }
+ else if (package->isInstalled()) {
+ if (locked)
+ pixbuf = icons->installed_locked;
+ else
+ pixbuf = icons->installed;
+ }
+ else {
+ if (locked)
+ pixbuf = icons->available_locked;
+ else
+ pixbuf = icons->available;
+ }
+ g_value_set_object (value, (GObject *) pixbuf);
+ break;
+ }
+ case YGtkZyppModel::NAME_COLUMN:
+ {
+ std::string name = package->name();
+ const unsigned int max_width = 15;
+ if (name.size() > max_width) {
+ name.erase (max_width-3);
+ name += "...";
+ }
+ g_value_set_string (value, g_strdup (name.c_str()));
+ break;
+ }
+ case YGtkZyppModel::NAME_DESCRIPTION_COLUMN:
+ {
+ std::string str = package->name();
+ std::string summary = package->summary();
+ if (!summary.empty()) {
+ YGUtils::escapeMarkup (summary);
+ str += "\n<small>" + summary + "</small>";
+ }
+ g_value_set_string (value, g_strdup (str.c_str()));
+ break;
+ }
+ case YGtkZyppModel::PTR_COLUMN:
+ {
+ void *ptr;
+ ptr = (void *) package;
+ g_value_set_pointer (value, ptr);
+ break;
+ }
+ case YGtkZyppModel::SPECIAL_ICON_COLUMN:
+ {
+ if (package->is3D())
+ g_value_set_object (value, (GObject *) icons->is_3D);
+ else
+ g_value_set_object (value, NULL);
+ break;
+ }
+ default:
+ g_warning ("YGtkZyppModel column %d doesn't exist.", column);
+ break;
+ }
+}
+
+static gboolean ygtk_zypp_model_iter_children (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreeIter *parent)
+{
+ return FALSE;
+}
+
+static gboolean ygtk_zypp_model_iter_has_child (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ return FALSE;
+}
+
+static gint ygtk_zypp_model_iter_n_children (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ return 0;
+}
+
+static gboolean ygtk_zypp_model_iter_nth_child (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreeIter *parent, gint n)
+{
+ return FALSE;
+}
+
+static gboolean ygtk_zypp_model_iter_parent (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreeIter *child)
+{
+ return FALSE;
+}
+
+YGtkZyppModel *ygtk_zypp_model_new (Ypp::Query *query)
+{
+ YGtkZyppModel *zmodel = (YGtkZyppModel *) g_object_new (YGTK_TYPE_ZYPP_MODEL, NULL);
+ zmodel->notify = new YGtkZyppModel::PoolNotify();
+ zmodel->notify->model = zmodel;
+ zmodel->pool = new Ypp::Pool (query);
+ zmodel->pool->setListener (zmodel->notify);
+ return zmodel;
+}
+
+static void ygtk_zypp_model_class_init (YGtkZyppModelClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = ygtk_zypp_model_finalize;
+}
+
+static void ygtk_zypp_model_tree_model_init (GtkTreeModelIface *iface)
+{
+ iface->get_flags = ygtk_zypp_model_get_flags;
+ iface->get_n_columns = ygtk_zypp_model_get_n_columns;
+ iface->get_column_type = ygtk_zypp_model_get_column_type;
+ iface->get_iter = ygtk_zypp_model_get_iter;
+ iface->get_path = ygtk_zypp_model_get_path;
+ iface->get_value = ygtk_zypp_model_get_value;
+ iface->iter_next = ygtk_zypp_model_iter_next;
+ iface->iter_children = ygtk_zypp_model_iter_children;
+ iface->iter_has_child = ygtk_zypp_model_iter_has_child;
+ iface->iter_n_children = ygtk_zypp_model_iter_n_children;
+ iface->iter_nth_child = ygtk_zypp_model_iter_nth_child;
+ iface->iter_parent = ygtk_zypp_model_iter_parent;
+}
+
Added: trunk/gtk/src/ygtkzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppwrapper.h?rev=43…
==============================================================================
--- trunk/gtk/src/ygtkzyppwrapper.h (added)
+++ trunk/gtk/src/ygtkzyppwrapper.h Thu Dec 20 21:38:55 2007
@@ -0,0 +1,54 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* Contains ZyppWrapper query results in a GtkTreeModel.
+*/
+
+#ifndef YGTK_ZYPP_WRAPPER_H
+#define YGTK_ZYPP_WRAPPER_H
+
+#include "yzyppwrapper.h"
+#include <gtk/gtktreemodel.h>
+
+#define YGTK_TYPE_ZYPP_MODEL (ygtk_zypp_model_get_type ())
+#define YGTK_ZYPP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_ZYPP_MODEL, YGtkZyppModel))
+#define YGTK_ZYPP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_ZYPP_MODEL, YGtkZyppModelClass))
+#define YGTK_IS_ZYPP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YGTK_TYPE_ZYPP_MODEL))
+#define YGTK_IS_ZYPP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), YGTK_TYPE_ZYPP_MODEL))
+#define YGTK_ZYPP_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_ZYPP_MODEL, YGtkZyppModelClass))
+
+struct YGtkZyppModel
+{
+ GObject parent;
+
+ enum Columns {
+ ICON_COLUMN, NAME_COLUMN, NAME_DESCRIPTION_COLUMN, PTR_COLUMN,
+ SPECIAL_ICON_COLUMN, TOTAL_COLUMNS
+ };
+
+ Ypp::Pool *pool;
+
+ struct PoolNotify;
+ PoolNotify *notify;
+};
+
+struct YGtkZyppModelClass
+{
+ GObjectClass parent_class;
+};
+
+YGtkZyppModel *ygtk_zypp_model_new (Ypp::Query *query);
+GType ygtk_zypp_model_get_type (void) G_GNUC_CONST;
+// besides calling Ypp for cleaning, it also cleans the icons of this hook
+void ygtk_zypp_model_finish();
+
+void ygtk_zypp_model_entry_changed (YGtkZyppModel *model, Ypp::Pool::Iter iter);
+void ygtk_zypp_model_entry_inserted (YGtkZyppModel *model, Ypp::Pool::Iter iter);
+void ygtk_zypp_model_entry_deleted (YGtkZyppModel *model, Ypp::Pool::Iter iter);
+
+#endif /*YGTK_ZYPP_WRAPPER_H*/
+
Added: trunk/gtk/src/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=4321…
==============================================================================
--- trunk/gtk/src/yzyppwrapper.cc (added)
+++ trunk/gtk/src/yzyppwrapper.cc Thu Dec 20 21:38:55 2007
@@ -0,0 +1,1478 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* Ypp, zypp wrapper */
+// check the header file for information about this wrapper
+
+#include <config.h>
+#include "YGi18n.h"
+#include "yzyppwrapper.h"
+
+#include <ycp/y2log.h>
+#include <zypp/ZYppFactory.h>
+#include <zypp/ResObject.h>
+#include <zypp/ResPoolProxy.h>
+#include <zypp/ui/Selectable.h>
+#include <zypp/Patch.h>
+#include <zypp/Selection.h>
+#include <zypp/Package.h>
+#include <zypp/Pattern.h>
+#include <zypp/Language.h>
+#include <zypp/Product.h>
+#include <zypp/Repository.h>
+#include <zypp/RepoManager.h>
+
+#include <glib/gslist.h>
+#include "YGUtils.h"
+
+//** Zypp shortcuts
+
+typedef zypp::ResPoolProxy ZyppPool;
+inline ZyppPool zyppPool() { return zypp::getZYpp()->poolProxy(); }
+typedef zypp::ui::Selectable::Ptr ZyppSelectable;
+typedef zypp::ui::Selectable* ZyppSelectablePtr;
+typedef zypp::ResObject::constPtr ZyppObject;
+typedef zypp::ResObject* ZyppObjectPtr;
+typedef zypp::Package::constPtr ZyppPackage;
+typedef zypp::Patch::constPtr ZyppPatch;
+typedef zypp::Pattern::constPtr ZyppPattern;
+typedef zypp::Language::constPtr ZyppLanguage;
+inline ZyppPackage tryCastToZyppPkg (ZyppObject obj)
+{ return zypp::dynamic_pointer_cast <const zypp::Package> (obj); }
+inline ZyppPatch tryCastToZyppPatch (ZyppObject obj)
+{ return zypp::dynamic_pointer_cast <const zypp::Patch> (obj); }
+inline ZyppPattern tryCastToZyppPattern (ZyppObject obj)
+{ return zypp::dynamic_pointer_cast <const zypp::Pattern> (obj); }
+inline ZyppLanguage tryCastToZyppLanguage (ZyppObject obj)
+{ return zypp::dynamic_pointer_cast <const zypp::Language> (obj); }
+
+//** Utilities
+
+// converts a set of tree representation in a form of a strings to a tree structure.
+// String tree representations are, for instance, filenames: /dir1/dir2/file
+struct StringTree {
+ typedef int (*Compare)(const char *, const char *);
+ Compare compare;
+ char delim;
+ GNode *root;
+
+ StringTree (Compare compare, char delim)
+ : compare (compare), delim (delim)
+ {
+ // the root is a dummy node to keep GNode happy
+ root = g_node_new (NULL);
+ }
+
+ ~StringTree()
+ {
+ struct inner {
+ static void free (GNode *node, void *_data)
+ { delete ((Ypp::Node *) node->data); }
+ };
+ g_node_children_foreach (root, G_TRAVERSE_ALL, inner::free, NULL);
+ g_node_destroy (root);
+ }
+
+ Ypp::Node *getFirst()
+ {
+ return (Ypp::Node *) root->children->data;
+ }
+
+ Ypp::Node *add (const std::string &tree_str)
+ {
+ const std::list <std::string> nodes_str = YGUtils::splitString (tree_str, delim);
+ GNode *parent = root, *sibling = 0;
+ Ypp::Node *ret = 0;
+
+ std::list <std::string>::const_iterator it;
+ for (it = nodes_str.begin(); it != nodes_str.end(); it++) {
+ bool found = false;
+ for (sibling = parent->children; sibling; sibling = sibling->next) {
+ Ypp::Node *yNode = (Ypp::Node *) sibling->data;
+ int cmp = (*compare) (it->c_str(), yNode->name.c_str());
+ if (cmp == 0) {
+ found = true;
+ ret = yNode;
+ break;
+ }
+ else if (cmp < 0)
+ break;
+ }
+ if (!found)
+ break;
+ parent = sibling;
+ }
+
+ for (; it != nodes_str.end(); it++) {
+ Ypp::Node *yNode = new Ypp::Node();
+ GNode *n = g_node_new ((void *) yNode);
+ yNode->name = *it;
+ yNode->impl = (void *) n;
+ g_node_insert_before (parent, sibling, n);
+ parent = n;
+ sibling = NULL;
+ ret = yNode;
+ }
+ return ret;
+ }
+};
+
+//** Singleton
+
+static Ypp *ypp = 0;
+
+Ypp *Ypp::get()
+{
+ if (!ypp)
+ ypp = new Ypp();
+ return ypp;
+}
+
+void Ypp::finish()
+{
+ delete ypp; ypp = NULL;
+}
+
+// Ypp::Impl declaration, to expose some methods for usage
+struct Ypp::Impl
+{
+public:
+ Impl();
+ ~Impl();
+
+ const Repository *getRepository (int nb);
+ int getRepository (const std::string &zyppId);
+ Disk *getDisk();
+
+ // for Packages
+ bool acceptLicense (Ypp::Package *package, const std::string &license);
+ void packageModified (Ypp::Package *package);
+
+ // for Pools
+ void addPool (Pool::Impl *pool);
+ void removePool (Pool::Impl *pool);
+ GSList *getPackages (Package::Type type);
+
+private:
+ bool resolveProblems();
+ Node *addCategory (Package::Type type, const std::string &str, Package *package);
+ void polishCategories (Ypp::Package::Type type);
+
+ void startTransactions();
+ void finishTransactions();
+
+ friend class Ypp;
+ GSList *packages [Package::TOTAL_TYPES]; // primitive pools
+ StringTree *categories [Package::TOTAL_TYPES];
+ GSList *repos;
+ Disk *disk;
+ Interface *interface;
+ GSList *pools;
+ bool inTransaction;
+ GSList *transactions;
+};
+
+//** Package
+
+struct Ypp::Package::Impl
+{
+ Impl (ZyppSelectable sel)
+ : zyppSel (sel), index (-1), availableVersions (NULL), installedVersion (NULL), is3D (false)
+ {
+ // don't use getAvailableVersion(0) for hasUpgrade() has its inneficient.
+ // let's just cache candidate() at start, which should point to the newest version.
+ hasUpgrade = false;
+ ZyppObject candidate = zyppSel->candidateObj();
+ ZyppObject installed = zyppSel->installedObj();
+ if (!!candidate && !!installed)
+ hasUpgrade = zypp::Edition::compare (candidate->edition(), installed->edition()) > 0;
+ setUnmodified();
+ }
+
+ ~Impl()
+ {
+ delete installedVersion;
+ for (GSList *i = availableVersions; i; i = i->next)
+ delete ((Version *) i->data);
+ g_slist_free (availableVersions);
+ }
+
+ inline bool isModified()
+ { return curStatus != zyppSel->status(); }
+ inline void setUnmodified()
+ { curStatus = zyppSel->status(); }
+
+ std::string name, summary;
+ ZyppSelectable zyppSel;
+ int index; // used for Pools syncing
+ Type type;
+ Ypp::Node *category;
+ GSList *availableVersions;
+ Version *installedVersion;
+ bool hasUpgrade;
+ bool is3D;
+ zypp::ui::Status curStatus; // so we know if resolver touched it
+};
+
+Ypp::Package::Package (Ypp::Package::Impl *impl)
+: impl (impl)
+{}
+Ypp::Package::~Package()
+{ delete impl; }
+
+Ypp::Package::Type Ypp::Package::type()
+{ return impl->type; }
+
+const std::string &Ypp::Package::name()
+{
+ std::string &ret = impl->name;
+ if (ret.empty()) {
+ ZyppSelectable sel = impl->zyppSel;
+ ZyppObject obj = sel->theObj();
+ switch (impl->type) {
+ case PATTERN_TYPE:
+ ret = obj->summary();
+ case LANGUAGE_TYPE:
+ ret = obj->description();
+ default:
+ ret = sel->name();
+ }
+ }
+ return ret;
+}
+
+const std::string &Ypp::Package::summary()
+{
+ std::string &ret = impl->summary;
+ if (ret.empty()) {
+ if (impl->type == PACKAGE_TYPE)
+ ret = impl->zyppSel->theObj()->summary();
+ }
+ return ret;
+}
+
+std::string Ypp::Package::description()
+{
+ ZyppObject object = impl->zyppSel->theObj();
+ std::string text = object->description(), br = "<br>";
+ if (impl->type == PACKAGE_TYPE) {
+ // if it has this header, then it is HTML
+ const char *header = "<!-- DT:Rich -->", header_len = 16;
+ if (!text.compare (0, header_len, header, header_len))
+ text.erase (0, header_len);
+ else {
+ // add breakline for every double one...
+ YGUtils::replace (text, "\n\n", 2, "<br>");
+/* std::string::size_type i = 0;
+ while ((i = text.find ("\n\n", i)) < std::string::npos) {
+ text.erase (i, 2); // remove it, so we don't trip on it again
+ text.insert (i, "<br>");
+ }*/
+ }
+
+ ZyppPackage package = tryCastToZyppPkg (object);
+ std::string url = package->url(), license = package->license();
+ if (!url.empty())
+ text += br + _("Website: ") + url;
+ if (!license.empty())
+ text += br + _("License: ") + license;
+ }
+ text += br + _("Size: ") + object->size().asString();
+ return text;
+}
+
+std::string Ypp::Package::filelist()
+{
+ std::string text;
+ ZyppObject object = impl->zyppSel->installedObj();
+ ZyppPackage package = tryCastToZyppPkg (object);
+ if (package) {
+ StringTree tree (YGUtils::strcmp, '/');
+
+ const std::list <std::string> &filesList = package->filenames();
+ for (std::list <std::string>::const_iterator it = filesList.begin();
+ it != filesList.end(); it++)
+ tree.add (*it);
+
+ struct inner {
+ static std::string getPath (GNode *node)
+ {
+ Node *yNode = (Node *) node->data;
+ if (!yNode)
+ return std::string();
+ return getPath (node->parent) + "/" + yNode->name;
+ }
+ static bool hasNextLeaf (GNode *node)
+ {
+ GNode *i;
+ for (i = node->next; i; i = i->next)
+ if (!i->children)
+ return true;
+ return false;
+ }
+ static bool hasPrevLeaf (GNode *node)
+ {
+ GNode *i;
+ for (i = node->prev; i; i = i->prev)
+ if (!i->children)
+ return true;
+ return false;
+ }
+ static gboolean traverse (GNode *node, void *_data)
+ {
+ Node *yNode = (Node *) node->data;
+ if (yNode) {
+ std::string *str = (std::string *) _data;
+ if (!hasPrevLeaf (node)) {
+ std::string path = getPath (node->parent);
+ *str += "<a href=" + path + ">" + path + "</a>";
+ *str += "<blockquote>";
+ }
+ else
+ *str += ", ";
+ *str += yNode->name;
+
+ if (!hasNextLeaf (node))
+ *str += "</blockquote>";
+ }
+ return FALSE;
+ }
+ };
+ g_node_traverse (tree.root, G_LEVEL_ORDER, G_TRAVERSE_LEAFS, -1,
+ inner::traverse, (void *) &text);
+ }
+ return text;
+}
+
+std::string Ypp::Package::changelog()
+{
+ string text;
+ ZyppObject object = impl->zyppSel->installedObj();
+ ZyppPackage package = tryCastToZyppPkg (object);
+ if (package) {
+ const std::list <zypp::ChangelogEntry> &changelogList = package->changelog();
+ for (std::list <zypp::ChangelogEntry>::const_iterator it = changelogList.begin();
+ it != changelogList.end(); it++) {
+ std::string author = it->author(), changes = it->text();
+ YGUtils::escapeMarkup (author);
+ YGUtils::escapeMarkup (changes);
+ YGUtils::replace (changes, "\n", 1, "<br>");
+ text += it->date().asString() + author + ":<br>"
+ + "<blockquote>" + changes + "</blockqute>";
+ }
+ }
+ return text;
+}
+
+std::string Ypp::Package::authors()
+{
+fprintf (stderr, "authors %s\n", name().c_str());
+ std::string text;
+ ZyppObject object = impl->zyppSel->theObj();
+ ZyppPackage package = tryCastToZyppPkg (object);
+ if (package) {
+ std::string packager = package->packager(), authors;
+ YGUtils::escapeMarkup (packager);
+ const std::list <std::string> &authorsList = package->authors();
+ for (std::list <std::string>::const_iterator it = authorsList.begin();
+ it != authorsList.end(); it++) {
+ std::string author = *it;
+ YGUtils::escapeMarkup (author);
+ if (!authors.empty())
+ authors += "<br>";
+ authors += author;
+fprintf (stderr, "\t add author %s\n", author.c_str());
+ }
+ // Some packagers put Authors over the Descriptions field. This seems to be rare
+ // on, so I'm not even going to bother.
+
+ if (!packager.empty())
+ text += _("Packaged by:") + ("<blockquote>" + packager) + "</blockquote>";
+ if (!authors.empty())
+ text += _("Developed by:") + ("<blockquote>" + authors) + "</blockquote>";
+ }
+ return text;
+}
+
+std::string Ypp::Package::provides()
+{
+ std::string text;
+ ZyppObject object = impl->zyppSel->theObj();
+ const zypp::CapSet &capSet = object->dep (zypp::Dep::PROVIDES);
+ for (zypp::CapSet::const_iterator it = capSet.begin();
+ it != capSet.end(); it++) {
+ if (!text.empty())
+ text += "\n";
+ text += it->asString();
+ }
+ return text;
+}
+
+std::string Ypp::Package::requires()
+{
+ std::string text;
+ ZyppObject object = impl->zyppSel->theObj();
+ const zypp::CapSet &capSet = object->dep (zypp::Dep::REQUIRES);
+ for (zypp::CapSet::const_iterator it = capSet.begin();
+ it != capSet.end(); it++) {
+ if (!text.empty())
+ text += "\n";
+ text += it->asString();
+ }
+ return text;
+}
+
+Ypp::Node *Ypp::Package::category()
+{
+ return impl->category;
+}
+
+bool Ypp::Package::is3D()
+{
+ return impl->is3D;
+}
+
+
+bool Ypp::Package::isInstalled()
+{
+ return impl->zyppSel->hasInstalledObj();
+}
+
+bool Ypp::Package::hasUpgrade()
+{
+ return impl->hasUpgrade;
+}
+
+bool Ypp::Package::isLocked()
+{
+ zypp::ui::Status status = impl->zyppSel->status();
+ return status == zypp::ui::S_Taboo || status == zypp::ui::S_Protected;
+}
+
+bool Ypp::Package::toInstall (int *nb)
+{
+ if (nb) {
+ ZyppObject candidate = impl->zyppSel->candidateObj();
+ for (int i = 0; getAvailableVersion (i); i++) {
+ const Version *version = getAvailableVersion (i);
+ ZyppObject i_obj = (ZyppObjectPtr) version->impl;
+ if (i_obj == candidate) {
+ *nb = i;
+ break;
+ }
+ }
+ }
+ return impl->zyppSel->toInstall();
+}
+
+bool Ypp::Package::toRemove()
+{
+ return impl->zyppSel->toDelete();
+}
+
+bool Ypp::Package::isModified()
+{
+ return impl->zyppSel->toModify();
+}
+
+bool Ypp::Package::isAuto()
+{
+ zypp::ui::Status status = impl->zyppSel->status();
+ return status == zypp::ui::S_AutoInstall || status == zypp::ui::S_AutoUpdate ||
+ status == zypp::ui::S_AutoDel;
+}
+
+void Ypp::Package::install (int nb)
+{
+ if (isLocked())
+ return;
+ if (!impl->zyppSel->hasLicenceConfirmed())
+ {
+ const std::string &license = impl->zyppSel->candidateObj()->licenseToConfirm();
+ if (!license.empty())
+ if (!ypp->impl->acceptLicense (this, license))
+ return;
+ impl->zyppSel->setLicenceConfirmed();
+ }
+
+ zypp::ui::Status status = impl->zyppSel->status();
+ switch (status) {
+ // not applicable
+ case zypp::ui::S_Protected:
+ case zypp::ui::S_Taboo:
+ case zypp::ui::S_Install:
+ case zypp::ui::S_Update:
+ break;
+ // undo
+ case zypp::ui::S_Del:
+ status = zypp::ui::S_KeepInstalled;
+ break;
+ // nothing to do about it
+ case zypp::ui::S_AutoDel:
+ break;
+ // action
+ case zypp::ui::S_NoInst:
+ case zypp::ui::S_AutoInstall:
+ status = zypp::ui::S_Install;
+ break;
+ case zypp::ui::S_KeepInstalled:
+ case zypp::ui::S_AutoUpdate:
+ status = zypp::ui::S_Update;
+ break;
+ }
+
+ impl->zyppSel->set_status (status);
+ if (toInstall()) {
+ const Version *version = getAvailableVersion (nb);
+ ZyppObject candidate = (ZyppObjectPtr) version->impl;
+ if (!impl->zyppSel->setCandidate (candidate)) {
+ y2warning ("Error: Could not set package '%s' candidate to '%s'\n",
+ name().c_str(), version->number.c_str());
+ return;
+ }
+ }
+
+ ypp->impl->packageModified (this);
+}
+
+void Ypp::Package::remove()
+{
+ zypp::ui::Status status = impl->zyppSel->status();
+ switch (status) {
+ // not applicable
+ case zypp::ui::S_Protected:
+ case zypp::ui::S_Taboo:
+ case zypp::ui::S_NoInst:
+ case zypp::ui::S_Del:
+ break;
+ // undo
+ case zypp::ui::S_Install:
+ status = zypp::ui::S_NoInst;
+ break;
+ // nothing to do about it
+ case zypp::ui::S_AutoInstall:
+ case zypp::ui::S_AutoUpdate:
+ break;
+ case zypp::ui::S_Update:
+ status = zypp::ui::S_KeepInstalled;
+ break;
+ // action
+ case zypp::ui::S_KeepInstalled:
+ case zypp::ui::S_AutoDel:
+ status = zypp::ui::S_Del;
+ break;
+ }
+
+ impl->zyppSel->set_status (status);
+ ypp->impl->packageModified (this);
+}
+
+void Ypp::Package::undo()
+{
+ zypp::ui::Status status = impl->zyppSel->status();
+ switch (status) {
+ // not applicable
+ case zypp::ui::S_Protected:
+ case zypp::ui::S_Taboo:
+ case zypp::ui::S_NoInst:
+ case zypp::ui::S_KeepInstalled:
+ break;
+
+ // undo
+ case zypp::ui::S_Install:
+ status = zypp::ui::S_NoInst;
+ break;
+ case zypp::ui::S_Update:
+ case zypp::ui::S_Del:
+ status = zypp::ui::S_KeepInstalled;
+ break;
+
+ // for auto status, undo them by locking them
+ case zypp::ui::S_AutoInstall:
+ status = zypp::ui::S_Taboo;
+ break;
+ case zypp::ui::S_AutoUpdate:
+ case zypp::ui::S_AutoDel:
+ status = zypp::ui::S_Protected;
+ break;
+ }
+
+ impl->zyppSel->set_status (status);
+ ypp->impl->packageModified (this);
+}
+
+void Ypp::Package::lock (bool lock)
+{
+ undo();
+
+ zypp::ui::Status status;
+ if (lock)
+ status = isInstalled() ? zypp::ui::S_Protected : zypp::ui::S_Taboo;
+ else
+ status = isInstalled() ? zypp::ui::S_KeepInstalled : zypp::ui::S_NoInst;
+
+ impl->zyppSel->set_status (status);
+ ypp->impl->packageModified (this);
+}
+
+static Ypp::Package::Version *constructVersion (ZyppObject object)
+{
+ Ypp::Package::Version *version = new Ypp::Package::Version();
+ version->number = object->edition().version();
+ version->repo = ypp->impl->getRepository (object->repository().info().alias());
+ version->cmp = 0;
+ version->impl = (void *) get_pointer (object);
+ return version;
+}
+
+const Ypp::Package::Version *Ypp::Package::getInstalledVersion()
+{
+ if (!impl->installedVersion) {
+ const ZyppObject installedObj = impl->zyppSel->installedObj();
+ if (installedObj)
+ impl->installedVersion = constructVersion (installedObj);
+ }
+ return impl->installedVersion;
+}
+
+const Ypp::Package::Version *Ypp::Package::getAvailableVersion (int nb)
+{
+ if (!impl->availableVersions) {
+ const ZyppObject installedObj = impl->zyppSel->installedObj();
+ for (zypp::ui::Selectable::available_iterator it = impl->zyppSel->availableBegin();
+ it != impl->zyppSel->availableEnd(); it++) {
+ Version *version = constructVersion (*it);
+ if (installedObj)
+ version->cmp = zypp::Edition::compare ((*it)->edition(), installedObj->edition());
+ impl->availableVersions = g_slist_append (impl->availableVersions, version);
+ }
+ struct inner {
+ static gint version_compare (gconstpointer pa, gconstpointer pb)
+ {
+ ZyppObjectPtr a = (ZyppObjectPtr) ((Version *) pa)->impl;
+ ZyppObjectPtr b = (ZyppObjectPtr) ((Version *) pb)->impl;
+ // swapped arguments, as we want them sorted from newer to older
+ return zypp::Edition::compare (b->edition(), a->edition());
+ }
+ };
+ impl->availableVersions = g_slist_sort (impl->availableVersions,
+ inner::version_compare);
+ }
+ return (Version *) g_slist_nth_data (impl->availableVersions, nb);
+}
+
+bool Ypp::Package::isOnRepository (int repo_nb)
+{
+ int i;
+ for (i = 0; getAvailableVersion (i); i++)
+ if (getAvailableVersion (i)->repo == repo_nb)
+ return true;
+ // if there are no availables, answer yes to all repos
+ return i == 0;
+}
+
+//** Query
+
+struct Ypp::Query::Impl
+{
+ template <typename T>
+ struct Key
+ {
+ Key()
+ : defined (false)
+ {}
+ void define (T v)
+ {
+ defined = true;
+ value = v;
+ }
+ bool is (const T &v) const
+ {
+// if (!defined) return true;
+ return value == v;
+ }
+ bool defined;
+ T value;
+ };
+
+ Key <Ypp::Package::Type> type;
+ Key <std::list <std::string> > name;
+ Key <Ypp::Node *> category;
+ Key <bool> isInstalled;
+ Key <bool> hasUpgrade;
+ Key <bool> isModified;
+ Key <std::list <int> > onRepositories;
+
+ Impl()
+ {}
+
+ bool match (Package *package)
+ {
+ bool match = true;
+// we must avoid passing values by copy, as well as zypp calls
+ if (match && type.defined)
+ match = type.is (package->type());
+ if (match && isInstalled.defined)
+ match = isInstalled.is (package->isInstalled());
+ if (match && hasUpgrade.defined)
+ match = hasUpgrade.is (package->hasUpgrade());
+ if (match && isModified.defined)
+ match = isModified.is (package->isModified());
+ if (match && name.defined) {
+ const std::list <std::string> &names = name.value;
+ std::list <std::string>::const_iterator it;
+ for (it = names.begin(); it != names.end(); it++) {
+ if (!YGUtils::contains (package->name(), *it) &&
+ !YGUtils::contains (package->summary(), *it) &&
+ !YGUtils::contains (package->provides(), *it)) {
+ match = false;
+ break;
+ }
+ }
+ }
+ if (match && category.defined) {
+ Ypp::Node *query_category = category.value;
+ Ypp::Node *pkg_category = package->category();
+ GNode *node = (GNode *) query_category->impl;
+ if (!g_node_find (node, G_PRE_ORDER, G_TRAVERSE_ALL, pkg_category))
+ match = false;
+ }
+ if (match && onRepositories.defined) {
+ const std::list <int> &repos = onRepositories.value;
+ std::list <int>::const_iterator it;
+ for (it = repos.begin(); it != repos.end(); it++)
+ if (package->isOnRepository (*it))
+ break;
+ match = it != repos.end();
+ }
+ return match;
+ }
+};
+
+Ypp::Query::Query (Ypp::Package::Type type)
+{
+ impl = new Impl();
+ impl->type.define (type);
+}
+Ypp::Query::~Query()
+{ delete impl; }
+
+void Ypp::Query::setName (std::string value)
+{ impl->name.define (YGUtils::splitString (value, ' ')); }
+void Ypp::Query::setCategory (Ypp::Node *value)
+{ impl->category.define (value); }
+void Ypp::Query::setIsInstalled (bool value)
+{ impl->isInstalled.define (value); }
+void Ypp::Query::setHasUpgrade (bool value)
+{ impl->hasUpgrade.define (value); }
+void Ypp::Query::setIsModified (bool value)
+{ impl->isModified.define (value); }
+void Ypp::Query::setRepositories (std::list <int> value)
+{ impl->onRepositories.define (value); }
+
+//** Pool
+
+struct Ypp::Pool::Impl
+{
+Query *query;
+GSList *packages;
+Pool::Listener *listener;
+
+ Impl (Query *query)
+ : query (query), listener (NULL)
+ {
+ packages = buildPool (query);
+fprintf (stderr, "created pool, adding to Ypp\n");
+ ypp->impl->addPool (this);
+ }
+
+ ~Impl()
+ {
+fprintf (stderr, "destroyed pool, removing from Ypp\n");
+ ypp->impl->removePool (this);
+ delete query;
+ g_slist_free (packages);
+ }
+
+ void packageModified (Package *package)
+ {
+ bool match = query->impl->match (package);
+ int cmp = 1;
+ GSList *i;
+ for (i = packages; i; i = i->next) {
+ Package *pkg = (Package *) i->data;
+ if (pkg->impl->index == package->impl->index)
+ cmp = 0;
+ if (pkg->impl->index >= package->impl->index)
+ break;
+ }
+ if (cmp == 0) {
+ if (match) { // modified
+fprintf (stderr, "pool (%d) - touched: %s\n", g_slist_length (packages), package->name().c_str());
+ if (listener)
+ listener->entryChanged ((Iter) i, package);
+ }
+ else { // removed
+fprintf (stderr, "pool (%d) - remove: %s\n", g_slist_length (packages), package->name().c_str());
+ if (listener)
+ listener->entryDeleted ((Iter) i, package);
+ packages = g_slist_delete_link (packages, i);
+ }
+ }
+ else {
+ if (match) { // inserted
+fprintf (stderr, "pool (%d) - insert: %s\n", g_slist_length (packages), package->name().c_str());
+ if (i == NULL) {
+ packages = g_slist_append (packages, (gpointer) package);
+ i = g_slist_last (packages);
+ }
+ else {
+ packages = g_slist_insert_before (packages, i, (gpointer) package);
+ int index = g_slist_position (packages, i) - 1;
+ i = g_slist_nth (packages, index);
+ }
+ if (listener)
+ listener->entryInserted ((Iter) i, package);
+ }
+ }
+ }
+
+private:
+ static GSList *buildPool (Query *query) // at construction
+ {
+long time1 = time(NULL);
+fprintf (stderr, "build pool...\n");
+ GSList *pool = NULL;
+ GSList *entire_pool = ypp->impl->getPackages (query->impl->type.value);
+ int index = 0;
+ for (GSList *i = entire_pool; i; i = i->next) {
+ Package *pkg = (Package *) i->data;
+ if (query->impl->match (pkg))
+ pool = g_slist_append (pool, i->data);
+ if (pkg->impl->index == -1)
+ pkg->impl->index = index++;
+ }
+fprintf (stderr, "delta time: %ld\n", time(NULL)-time1);
+ return pool;
+ }
+};
+
+Ypp::Pool::Pool (Query *query)
+{ impl = new Impl (query); }
+Ypp::Pool::~Pool()
+{ delete impl; }
+
+Ypp::Pool::Iter Ypp::Pool::getFirst()
+{ return impl->packages; }
+
+Ypp::Pool::Iter Ypp::Pool::getNext (Ypp::Pool::Iter iter)
+{ return ((GSList *) iter)->next; }
+
+Ypp::Package *Ypp::Pool::get (Ypp::Pool::Iter iter)
+{ return (Ypp::Package *) ((GSList *) iter)->data; }
+
+int Ypp::Pool::getIndex (Ypp::Pool::Iter iter)
+{ return g_slist_position (impl->packages, (GSList *) iter); }
+
+Ypp::Pool::Iter Ypp::Pool::getIter (int index)
+{ return g_slist_nth (impl->packages, index); }
+
+void Ypp::Pool::setListener (Ypp::Pool::Listener *listener)
+{ impl->listener = listener; }
+
+//** Misc
+
+struct Ypp::Disk::Impl
+{
+Ypp::Disk::Listener *listener;
+GSList *partitions;
+
+ Impl()
+ : partitions (NULL)
+ {
+ if (zypp::getZYpp()->diskUsage().empty())
+ zypp::getZYpp()->setPartitions (
+ zypp::DiskUsageCounter::detectMountPoints());
+ }
+
+ ~Impl()
+ {
+ clearPartitions();
+ }
+
+ void packageModified (Package *package)
+ {
+ clearPartitions();
+ if (listener)
+ listener->update();
+ }
+
+ void clearPartitions()
+ {
+ for (GSList *i = partitions; i; i = i->next)
+ delete ((Partition *) i->data);
+ g_slist_free (partitions);
+ partitions = NULL;
+ }
+
+ const Partition *getPartition (int nb)
+ {
+ if (!partitions) {
+ typedef zypp::DiskUsageCounter::MountPoint ZyppDu;
+ typedef zypp::DiskUsageCounter::MountPointSet ZyppDuSet;
+ typedef zypp::DiskUsageCounter::MountPointSet::iterator ZyppDuSetIterator;
+
+ ZyppDuSet diskUsage = zypp::getZYpp()->diskUsage();
+ for (ZyppDuSetIterator it = diskUsage.begin(); it != diskUsage.end(); it++) {
+ if (!it->readonly) {
+ // partition fields: dir, used_size, total_size (size on Kb)
+ Ypp::Disk::Partition *partition = new Partition();
+ partition->path = it->dir;
+ partition->used = it->pkg_size;
+ partition->total = it->total_size;
+ partition->used_str =
+ zypp::ByteCount (partition->used, zypp::ByteCount::K).asString();
+ partition->total_str =
+ zypp::ByteCount (partition->total, zypp::ByteCount::K).asString();
+ partitions = g_slist_append (partitions, (gpointer) partition);
+ }
+ }
+ }
+ return (Partition *) g_slist_nth_data (partitions, nb);
+ }
+};
+
+Ypp::Disk::Disk()
+{ impl = new Impl(); }
+Ypp::Disk::~Disk()
+{ delete impl; }
+
+void Ypp::Disk::setListener (Ypp::Disk::Listener *listener)
+{ impl->listener = listener; }
+
+const Ypp::Disk::Partition *Ypp::Disk::getPartition (int nb)
+{ return impl->getPartition (nb); }
+
+Ypp::Node *Ypp::getFirstCategory (Ypp::Package::Type type)
+{
+ return impl->categories[type]->getFirst();
+}
+
+Ypp::Node *Ypp::Node::next()
+{
+ GNode *ret = ((GNode *) impl)->next;
+ if (ret) return (Ypp::Node *) ret->data;
+ return NULL;
+}
+
+Ypp::Node *Ypp::Node::child()
+{
+ GNode *ret = ((GNode *) impl)->children;
+ if (ret) return (Ypp::Node *) ret->data;
+ return NULL;
+}
+
+struct CatConversor {
+ const char *from, *to;
+};
+static const CatConversor catConversor[] = {
+ { "Amusements/Games/3D", "Games/Action" },
+ { "Amusements/Games/Board/Puzzle", "Games/Logic" },
+ { "Amusements/Games/Board/Card", "Games/Card" },
+ { "Amusements/Games", "Games" },
+ { "Amusements", "Games" },
+ { "Applications/Publishing", "Office" },
+ { "Applications/Internet", "Network" },
+ { "Applications", "" },
+ { "Development/C", "Development/Libraries/C and C++" },
+ { "Development/Python", "Development/Libraries/Python" },
+ { "Development/Libraries/C", "Development/Libraries/C and C++" },
+ { "Libraries", "Development/Libraries" },
+ { "Productivity/Multimedia/Player", "Multimedia/Sound/Players" },
+ { "Productivity/Multimedia/Audio", "Multimedia/Sound/Players" },
+ { "Video", "Multimedia/Video" },
+ { "Productivity/Multimedia", "Multimedia" },
+ { "Productivity/Graphics", "Multimedia/Graphics" },
+ { "Productivity/Networking", "Network" },
+ { "Productivity/Network", "Network" },
+ { "Productivity/Office", "Office" },
+ { "Productivity/Publishing", "Office/Publishing" },
+ { "Productivity/Telephony", "Network/Telephony" },
+ { "Productivity", "Utilities" },
+ { "System/Emulators", "Emulators" },
+ { "System/GUI", "Utilities/GUI" },
+ { "System/Video", "Emulators" },
+ { "System/Libraries", "Development/Libraries/C and C++/System" },
+ { "X11/Applications/Multimedia", "Multimedia" },
+ { "X11/GNOME/Multimedia", "Multimedia" },
+ { "X11/Applications", "Utilities/GUI" },
+};
+#define CAT_CONVERSOR_SIZE (sizeof (catConversor)/sizeof (CatConversor))
+struct TypoConversor {
+ const char *from, *to, len;
+};
+static const TypoConversor catTypos[] = {
+ { "Others", "Other", 6 }, { "Utilites", "Utilities", 8 },
+ { "AOLInstantMessenge", "AOLInstantMessenger", 18 },
+ { "Library", "Libraries", 7 }, { "Libs", "Libraries", 4 },
+};
+#define CAT_TYPOS_SIZE (sizeof (catTypos)/sizeof (TypoConversor))
+
+Ypp::Node *Ypp::Impl::addCategory (Ypp::Package::Type type,
+ const std::string &category_str, Package *pkg)
+{
+ struct inner {
+ static int cmp (const char *a, const char *b)
+ {
+ // Other group should always go as last
+ if (!strcmp (a, "Other"))
+ return !strcmp (b, "Other") ? 0 : 1;
+ if (!strcmp (b, "Other"))
+ return -1;
+ return YGUtils::strcmp (a, b);
+ }
+
+ // Package categories guide-line don't seem to be enforced, some categories
+ // are duplicated, or don't make much sense. Let's try to cut on that.
+
+ static std::string treatCategory (const std::string &category, Package *pkg)
+ {
+ std::string ret (category);
+
+ // typos (end group only)
+ for (unsigned int c = 0; c < CAT_TYPOS_SIZE; c++) {
+ const char *from = catTypos[c].from, from_len = catTypos[c].len;
+ int ret_index = ret.length() - from_len;
+
+ if (ret_index >= 0 && ret.compare (ret_index, from_len, from, from_len) == 0) {
+ const char *to = catTypos[c].to;
+ ret.erase (ret_index);
+ ret.append (to);
+ break;
+ }
+ }
+
+ for (unsigned int c = 0; c < CAT_CONVERSOR_SIZE; c++) {
+ const char *from = catConversor[c].from;
+ unsigned int i;
+ for (i = 0; from[i] && i < ret.length(); i++)
+ if (from[i] != ret[i])
+ break;
+ if (!from[i] && (i == ret.length() || ret[i] == '/')) {
+ const char *to = catConversor[c].to;
+ ret.erase (0, i);
+ ret.insert (0, to);
+ if (c == 0 && pkg)
+ pkg->impl->is3D = true;
+ break;
+ }
+ }
+ return ret;
+ }
+ };
+
+ if (!categories[type])
+ categories[type] = new StringTree (inner::cmp, '/');
+ if (type == Package::PACKAGE_TYPE)
+ return categories[type]->add (inner::treatCategory (category_str, pkg));
+ else
+ return categories[type]->add (category_str);
+}
+
+void Ypp::Impl::polishCategories (Ypp::Package::Type type)
+{
+ // some treatment on categories
+ // Put all packages under a node (as opposite to packages on a leaf) to
+ // the Other category.
+ if (type == Package::PACKAGE_TYPE) {
+ GSList *pool = ypp->impl->getPackages (type);
+ for (GSList *i = pool; i; i = i->next) {
+ Package *pkg = (Package *) i->data;
+ Ypp::Node *ynode = pkg->category();
+ if (ynode->child()) {
+ GNode *node = (GNode *) ynode->impl;
+ GNode *last = g_node_last_child (node);
+ if (((Ypp::Node *) last->data)->name == "Other")
+ pkg->impl->category = (Ypp::Node *) last->data;
+ else {
+ // must create a "Other" node
+ fprintf (stderr, "creating Other\n");
+ Ypp::Node *yN = new Ypp::Node();
+ GNode *n = g_node_new ((void *) yN);
+ yN->name = "Other";
+ yN->impl = (void *) n;
+ g_node_insert_before (node, NULL, n);
+ pkg->impl->category = yN;
+ }
+ }
+ }
+ }
+}
+
+//** Ypp top methods & internal connections
+
+Ypp::Impl::Impl()
+: repos (NULL), disk (NULL), interface (NULL), pools (NULL),
+ inTransaction (false), transactions (NULL)
+{
+ for (int i = 0; i < Package::TOTAL_TYPES; i++) {
+ packages[i] = NULL;
+ categories[i] = NULL;
+ }
+}
+
+Ypp::Impl::~Impl()
+{
+ struct inner {
+ static void free_package (void *data, void *_data)
+ { delete ((Package *) data); }
+ static void free_repo (void *data, void *_data)
+ { delete ((Repository *) data); }
+ };
+
+ for (int t = 0; t < Package::TOTAL_TYPES; t++) {
+ g_slist_foreach (packages[t], inner::free_package, NULL);
+ g_slist_free (packages[t]);
+ delete categories[t];
+ }
+
+ g_slist_foreach (repos, inner::free_repo, NULL);
+ g_slist_free (repos);
+
+ // don't delete pools as they don't actually belong to Ypp, just listeners
+ g_slist_free (pools);
+ delete disk;
+}
+
+const Ypp::Repository *Ypp::Impl::getRepository (int nb)
+{
+ if (!repos) {
+ zypp::RepoManager manager;
+ std::list <zypp::RepoInfo> zrepos = manager.knownRepositories();
+ for (std::list <zypp::RepoInfo>::const_iterator it = zrepos.begin();
+ it != zrepos.end(); it++) {
+ if (it->enabled()) {
+ Repository *repo = new Repository();
+ repo->name = it->name();
+ repo->alias = it->alias();
+ repos = g_slist_append (repos, repo);
+ }
+ }
+ }
+ return (Repository *) g_slist_nth_data (repos, nb);
+}
+
+int Ypp::Impl::getRepository (const std::string &alias)
+{
+ for (int i = 0; getRepository (i); i++)
+ if (getRepository (i)->alias == alias)
+ return i;
+ return -1; /*error*/
+}
+
+Ypp::Disk *Ypp::Impl::getDisk()
+{
+ if (!disk)
+ disk = new Disk();
+ return disk;
+}
+
+bool Ypp::Impl::acceptLicense (Ypp::Package *package, const std::string &license)
+{
+ if (interface)
+ interface->acceptLicense (package, license);
+ return false;
+}
+
+Ypp::Problem::Solution *Ypp::Problem::getSolution (int nb)
+{
+ return (Ypp::Problem::Solution *) g_slist_nth_data ((GSList *) impl, nb);
+}
+
+bool Ypp::Impl::resolveProblems()
+{
+ zypp::Resolver_Ptr zResolver = zypp::getZYpp()->resolver();
+ bool resolved = false;
+ while (true) {
+ if (zResolver->resolvePool()) {
+ resolved = true;
+ break;
+ }
+ zypp::ResolverProblemList zProblems = zResolver->problems();
+ if ((resolved = zProblems.empty()))
+ break;
+
+ if (!interface)
+ break;
+
+ std::list <Problem *> problems;
+ for (zypp::ResolverProblemList::iterator it = zProblems.begin();
+ it != zProblems.end(); it++) {
+ Problem *problem = new Problem();
+ problem->description = (*it)->description();
+ problem->details = (*it)->details();
+ GSList *solutions = NULL;
+ zypp::ProblemSolutionList zSolutions = (*it)->solutions();
+ for (zypp::ProblemSolutionList::iterator jt = zSolutions.begin();
+ jt != zSolutions.end(); jt++) {
+ Problem::Solution *solution = new Problem::Solution();
+ solution->description = (*jt)->description();
+ solution->details = (*jt)->details();
+ solution->apply = false;
+ solution->impl = (void *) get_pointer (*jt);
+ solutions = g_slist_append (solutions, solution);
+ }
+ problem->impl = (void *) solutions;
+ problems.push_back (problem);
+ }
+
+ resolved = interface->resolveProblems (problems);
+
+ zypp::ProblemSolutionList choices;
+ for (std::list <Problem *>::iterator it = problems.begin();
+ it != problems.end(); it++) {
+ for (int i = 0; (*it)->getSolution (i); i++) {
+ Problem::Solution *solution = (*it)->getSolution (i);
+ if (resolved && solution->apply)
+ choices.push_back ((zypp::ProblemSolution *) solution->impl);
+ delete solution;
+ }
+ delete *it;
+ }
+
+ if (resolved)
+ zResolver->applySolutions (choices);
+ else
+ break;
+ }
+
+ if (!resolved)
+ zResolver->undo();
+ return resolved;
+}
+
+void Ypp::Impl::packageModified (Ypp::Package *package)
+{
+ // notify listeners of package change
+ for (GSList *i = pools; i; i = i->next) {
+fprintf (stderr, "ypp: informing pool of package modified\n");
+ ((Pool::Impl *) i->data)->packageModified (package);
+ }
+ if (disk)
+ disk->impl->packageModified (package);
+ if (interface)
+ interface->packageModified (package);
+
+ transactions = g_slist_append (transactions, package);
+ if (!inTransaction)
+ finishTransactions();
+}
+
+void Ypp::Impl::startTransactions()
+{
+ inTransaction = true;
+}
+
+void Ypp::Impl::finishTransactions()
+{
+ inTransaction = true;
+ bool resolved = resolveProblems();
+ if (resolved) {
+ // resolver won't tell us what changed -- tell pools about Auto packages
+ for (GSList *p = packages [Ypp::Package::PACKAGE_TYPE]; p; p = p->next) {
+ Ypp::Package *pkg = (Ypp::Package *) p->data;
+ if (pkg->impl->isModified()) {
+ for (GSList *i = pools; i; i = i->next)
+ ((Pool::Impl *) i->data)->packageModified (pkg);
+ pkg->impl->setUnmodified();
+ }
+ }
+ }
+ else {
+ // user canceled resolver -- undo all
+ for (GSList *i = transactions; i; i = i->next)
+ ((Ypp::Package *) i->data)->undo();
+ }
+ g_slist_free (transactions);
+ transactions = NULL;
+ inTransaction = false;
+}
+
+void Ypp::Impl::addPool (Pool::Impl *pool)
+{ fprintf (stderr, "ypp: adding pool\n"); pools = g_slist_append (pools, pool); }
+void Ypp::Impl::removePool (Pool::Impl *pool)
+{ fprintf (stderr, "ypp: removing pool\n"); pools = g_slist_remove (pools, pool); }
+
+#if 0
+// using auxiliary GSequence tree -- not yet shiped by Glib :X
+// in any case, a sort merge is very fast, as packages are more or less
+// sorted anyway...
+GSList *Ypp::Impl::getPackages (Ypp::Package::Type type)
+{
+ if (!packages[type]) {
+ // auxiliary for efficient alphabetic sorting
+ GSequence *pool = g_sequence_new (NULL);
+ struct inner {
+ static gint compare (gconstpointer _a, gconstpointer _b, gpointer _data)
+ {
+ Package *a = (Package *) _a;
+ Package *b = (Package *) _b;
+ return YGUtils::strcmp (a->name().c_str(), b->name().c_str());
+ }
+/* static void pool_foreach (gpointer data, gpointer _list)
+ {
+ GSList **list = (GSList **) _list;
+ *list = g_slist_append (*list, data);
+ }*/
+ };
+
+ ZyppPool::const_iterator it, end;
+ switch (type)
+ {
+ case Package::PACKAGE_TYPE:
+ it = zyppPool().byKindBegin <zypp::Package>();
+ end = zyppPool().byKindEnd <zypp::Package>();
+ break;
+ case Package::PATTERN_TYPE:
+ it = zyppPool().byKindBegin <zypp::Pattern>();
+ end = zyppPool().byKindEnd <zypp::Pattern>();
+ break;
+ case Package::LANGUAGE_TYPE:
+ it = zyppPool().byKindBegin <zypp::Language>();
+ end = zyppPool().byKindEnd <zypp::Language>();
+ break;
+ default:
+ break;
+ }
+ for (; it != end; it++)
+ {
+ Package *package = new Package (new Package::Impl (*it));
+ g_sequence_insert_sorted (pool, package, inner::compare, NULL);
+ }
+
+ // add stuff to the actual pool now
+ int index = 0;
+ for (GSequenceIter *it = g_sequence_get_begin_iter (pool);
+ !g_sequence_iter_is_end (it); it = g_sequence_iter_next (it)) {
+ gpointer data = g_sequence_get (it);
+ Package *pkg = (Package *) data;
+ pkg->impl->index = index++;
+ pkg->impl->type = type;
+ packages[type] = g_slist_append (packages[type], data);
+ }
+
+// g_sequence_foreach (pool, inner::pool_foreach, &);
+ g_sequence_free (pool);
+ }
+ return packages[type];
+}
+#else
+GSList *Ypp::Impl::getPackages (Ypp::Package::Type type)
+{
+ if (!packages[type]) {
+long time1 = time(NULL);
+fprintf (stderr, "creating pool of %d...\n", type);
+ GSList *pool = NULL;
+ struct inner {
+ static gint compare (gconstpointer _a, gconstpointer _b)
+ {
+ Package *a = (Package *) _a;
+ Package *b = (Package *) _b;
+ return YGUtils::strcmp (a->name().c_str(), b->name().c_str());
+ }
+ };
+
+ ZyppPool::const_iterator it, end;
+ switch (type) {
+ case Package::PACKAGE_TYPE:
+ it = zyppPool().byKindBegin <zypp::Package>();
+ end = zyppPool().byKindEnd <zypp::Package>();
+ break;
+ case Package::PATTERN_TYPE:
+ it = zyppPool().byKindBegin <zypp::Pattern>();
+ end = zyppPool().byKindEnd <zypp::Pattern>();
+ break;
+ case Package::LANGUAGE_TYPE:
+ it = zyppPool().byKindBegin <zypp::Language>();
+ end = zyppPool().byKindEnd <zypp::Language>();
+ break;
+ default:
+ break;
+ }
+ for (; it != end; it++) {
+ Package *package = new Package (new Package::Impl (*it));
+ Ypp::Node *category = 0;
+ if (type == Package::PACKAGE_TYPE) {
+ ZyppObject object = (*it)->theObj();
+ ZyppPackage zpackage = tryCastToZyppPkg (object);
+ if (!zpackage)
+ continue;
+ category = addCategory (type, zpackage->group(), package);
+ }
+ else if (type == Package::PATTERN_TYPE) {
+ ZyppObject object = (*it)->theObj();
+ ZyppPattern pattern = tryCastToZyppPattern (object);
+ if (!pattern || !pattern->userVisible())
+ continue;
+ category = addCategory (type, pattern->category(), 0);
+ }
+
+ package->impl->type = type;
+ package->impl->category = category;
+ pool = g_slist_prepend (pool, package);
+ }
+ // its faster to prepend then reverse, as we avoid iterating for each append
+ // lets reverse before sorting, as they are somewhat sorted already
+ pool = g_slist_reverse (pool);
+ // a sort merge. Don't use g_slist_insert_sorted() -- its linear
+ pool = g_slist_sort (pool, inner::compare);
+ packages[type] = pool;
+
+ polishCategories (type);
+fprintf (stderr, "delta time: %ld\n", time(NULL)-time1);
+ }
+ return packages[type];
+}
+#endif
+
+Ypp::Ypp()
+{
+ impl = new Impl();
+
+ zyppPool().saveState<zypp::Package >();
+ zyppPool().saveState<zypp::Pattern >();
+ zyppPool().saveState<zypp::Selection>();
+ zyppPool().saveState<zypp::Language >();
+ zyppPool().saveState<zypp::Patch >();
+}
+
+Ypp::~Ypp()
+{
+ delete impl;
+}
+
+const Ypp::Repository *Ypp::getRepository (int nb)
+{ return impl->getRepository (nb); }
+
+Ypp::Disk *Ypp::getDisk()
+{ return impl->getDisk(); }
+
+void Ypp::setInterface (Ypp::Interface *interface)
+{ impl->interface = interface; }
+
+bool Ypp::isModified()
+{
+ return zyppPool().diffState<zypp::Package >() ||
+ zyppPool().diffState<zypp::Pattern >() ||
+ zyppPool().diffState<zypp::Selection>() ||
+ zyppPool().diffState<zypp::Language >() ||
+ zyppPool().diffState<zypp::Patch >();
+}
+
+void Ypp::startTransactions()
+{ impl->startTransactions(); }
+
+void Ypp::finishTransactions()
+{ impl->finishTransactions(); }
+
Added: trunk/gtk/src/yzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.h?rev=43214…
==============================================================================
--- trunk/gtk/src/yzyppwrapper.h (added)
+++ trunk/gtk/src/yzyppwrapper.h Thu Dec 20 21:38:55 2007
@@ -0,0 +1,196 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* A simplification of libzypp's API.
+
+ To get a list of packages, setup a Query object and create a Pool with
+ it. Package has a set of manipulation methods, the results of which are
+ then reported to Pool listeners, which you can choose to act on your
+ interface, if you want them reflected on the viewer.
+ Iterate the pool using Pool::Iter. Don't keep it around though, instead use
+ getIndex() and getIter(index).
+
+ You must register an object that implements Interface, as some transactions
+ are bound by user decisions. Ypp is a singleton; first call to get() will
+ initialize it; you should call finish() when you're done to de-allocate
+ caches.
+ The only thing you should free is Pool objects. A Query will be freed by
+ the Pool object you pass it to.
+*/
+
+#ifndef ZYPP_WRAPPER_H
+#define ZYPP_WRAPPER_H
+
+#include <string>
+#include <list>
+
+struct Ypp
+{
+ // Utilities
+ struct Node {
+ std::string name;
+ Node *next();
+ Node *child();
+ void *impl;
+ };
+
+ // Entries
+ struct Package {
+ enum Type {
+ PACKAGE_TYPE, PATTERN_TYPE, LANGUAGE_TYPE, TOTAL_TYPES
+ };
+
+ Type type();
+ const std::string &name();
+ const std::string &summary();
+ Node *category();
+ bool is3D();
+
+ std::string description();
+ std::string filelist();
+ std::string changelog();
+ std::string authors();
+
+ std::string provides();
+ std::string requires();
+
+ bool isInstalled();
+ bool hasUpgrade();
+ bool isLocked();
+
+ bool toInstall (int *nb = 0);
+ bool toRemove();
+ bool isModified();
+ bool isAuto(); /* installing/removing cause of dependency */
+
+ void install (int nb); /* if installed, will replace it by that version */
+ void remove();
+ void undo();
+ void lock (bool lock);
+
+ struct Version {
+ std::string number;
+ int repo, cmp /*relatively to installed*/;
+ void *impl;
+ };
+ const Version *getInstalledVersion();
+ const Version *getAvailableVersion (int nb);
+
+ // convinience -- true if any available is from the given repo
+ bool isOnRepository (int repo);
+
+ struct Impl;
+ Impl *impl;
+ Package (Impl *impl);
+ ~Package();
+ };
+
+ // when installing/removing/... a few packages at a time, you should use this methods,
+ // so that problem resolver gets only kicked after they are all queued
+ void startTransactions();
+ void finishTransactions();
+
+ // Query
+ struct Query {
+ Query (Package::Type type);
+ void setName (std::string name);
+ void setCategory (Ypp::Node *category);
+ void setIsInstalled (bool installed);
+ void setHasUpgrade (bool upgradable);
+ void setIsModified (bool modified);
+ void setRepositories (std::list <int> repositories);
+
+ ~Query();
+ struct Impl;
+ Impl *impl;
+ };
+
+ // Pool
+ struct Pool {
+ Pool (Query *query);
+
+ typedef void * Iter;
+ Iter getFirst();
+ Iter getNext (Iter it);
+ Package *get (Iter it);
+ int getIndex (Iter it);
+ Iter getIter (int index);
+
+ struct Listener {
+ virtual void entryChanged (Iter iter, Package *package) = 0;
+ virtual void entryInserted (Iter iter, Package *package) = 0;
+ virtual void entryDeleted (Iter iter, Package *package) = 0;
+ };
+ void setListener (Listener *listener);
+
+ ~Pool();
+ struct Impl;
+ Impl *impl;
+ };
+
+ // Resolver
+ struct Problem {
+ std::string description, details;
+ struct Solution {
+ std::string description, details;
+ bool apply;
+ void *impl;
+ };
+ Solution *getSolution (int nb);
+ void *impl;
+ };
+
+ // Module
+ static Ypp *get();
+ static void finish();
+
+ struct Interface {
+ virtual bool acceptLicense (Package *package, const std::string &license) = 0;
+ // resolveProblems = false to cancel the action that had that effect
+ virtual bool resolveProblems (std::list <Problem *> problems) = 0;
+
+ // FIXME: this is mostly a hack; the thing is that GtkTreeSelection doesn't
+ // signal when a selected row changes values. Anyway, to be done differently.
+ virtual void packageModified (Package *package) = 0;
+ };
+ void setInterface (Interface *interface);
+
+ bool isModified(); // any change made?
+
+ // Misc
+ struct Repository {
+ std::string name, alias /*internal use*/;
+ };
+ const Repository *getRepository (int nb);
+
+ Node *getFirstCategory (Package::Type type);
+
+ struct Disk
+ {
+ struct Partition {
+ std::string path, used_str, total_str;
+ long long used, total;
+ };
+ const Partition *getPartition (int nb);
+
+ struct Listener {
+ virtual void update() = 0;
+ };
+ void setListener (Listener *listener);
+
+ Disk();
+ ~Disk();
+ struct Impl;
+ Impl *impl;
+ };
+ Disk *getDisk();
+
+ Ypp();
+ ~Ypp();
+ struct Impl;
+ Impl *impl;
+};
+
+#endif /*ZYPP_WRAPPER_H*/
+
--
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] r43213 - in /trunk/gtk/src: YGTextEntry.cc YGTime.cc YGTree.cc ygtkcellrendererarrow.c ygtkcellrendererarrow.h
by rpmcruz@svn.opensuse.org 20 Dec '07
by rpmcruz@svn.opensuse.org 20 Dec '07
20 Dec '07
Author: rpmcruz
Date: Thu Dec 20 21:38:05 2007
New Revision: 43213
URL: http://svn.opensuse.org/viewcvs/yast?rev=43213&view=rev
Log:
Moving unstable-libyui to main.
Removed:
trunk/gtk/src/YGTextEntry.cc
trunk/gtk/src/YGTime.cc
trunk/gtk/src/YGTree.cc
trunk/gtk/src/ygtkcellrendererarrow.c
trunk/gtk/src/ygtkcellrendererarrow.h
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
Author: rpmcruz
Date: Thu Dec 20 21:36:55 2007
New Revision: 43212
URL: http://svn.opensuse.org/viewcvs/yast?rev=43212&view=rev
Log:
Moving unstable-libyui to main.
Modified:
trunk/gtk/src/Makefile.am
trunk/gtk/src/YGComboBox.cc
trunk/gtk/src/YGImage.cc
trunk/gtk/src/YGLayout.cc
trunk/gtk/src/YGMultiLineEdit.cc
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/YGProgressBar.cc
trunk/gtk/src/YGPushButton.cc
trunk/gtk/src/YGUI.cc
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGUtils.h
trunk/gtk/src/YGWizard.cc
trunk/gtk/src/ygdkmngloader.c
trunk/gtk/src/ygtkratiobox.h
trunk/gtk/src/ygtkwizard.c
trunk/gtk/src/ygtkwizard.h
Modified: trunk/gtk/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/Makefile.am?rev=43212&r1…
==============================================================================
--- trunk/gtk/src/Makefile.am (original)
+++ trunk/gtk/src/Makefile.am Thu Dec 20 21:36:55 2007
@@ -46,11 +46,13 @@
ygtkfieldentry.c \
ygtkmenubutton.c \
ygtkwizard.c \
- ygtkcellrendererarrow.c \
ygtkfindentry.c \
ygdkmngloader.c \
+ ygtkimage.c \
ygtkhtmlwrap.c \
- ygtkrichtext.c
+ ygtkrichtext.c \
+ yzyppwrapper.cc \
+ ygtkzyppwrapper.cc
# should only append ygtkrichtext.c if USE_GTKHTML is set
dummy_SOURCES = dummy.cc
Modified: trunk/gtk/src/YGComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=43212&…
==============================================================================
--- trunk/gtk/src/YGComboBox.cc (original)
+++ trunk/gtk/src/YGComboBox.cc Thu Dec 20 21:36:55 2007
@@ -26,8 +26,9 @@
gtk_combo_box_set_model (GTK_COMBO_BOX (getWidget()), GTK_TREE_MODEL (store));
g_object_unref (store);
- if(opt.isEditable.value())
+ if(opt.isEditable.value()) {
gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (getWidget()), 0);
+ }
else {
GtkCellRenderer* cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (getWidget()), cell, TRUE);
Modified: trunk/gtk/src/YGImage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGImage.cc?rev=43212&r1=…
==============================================================================
--- trunk/gtk/src/YGImage.cc (original)
+++ trunk/gtk/src/YGImage.cc Thu Dec 20 21:36:55 2007
@@ -5,266 +5,57 @@
#include "ygdkmngloader.h"
#include <config.h>
#include <ycp/y2log.h>
-#include <YGUI.h>
-#include "YEvent.h"
+#include "YGUI.h"
#include "YGWidget.h"
#include "YImage.h"
+#include "ygtkimage.h"
class YGImage : public YImage, public YGWidget
{
- bool m_hasZeroWidth, m_hasZeroHeight, m_isScaled, m_isTiled, m_isAnimation;
- bool m_imageLoaded;
-
- struct Animation {
- GdkPixbufAnimation *pixbuf;
- GdkPixbufAnimationIter *frame;
- guint timeout_id;
- };
- union {
- GdkPixbuf *m_pixbuf;
- Animation *m_animation;
- };
- gchar *alt_text;
-
- void initOptions (const YWidgetOpt &opt)
+ void setProps (const YWidgetOpt &opt, const YCPString &alt_text)
{
- IMPL
- m_imageLoaded = false;
- m_hasZeroWidth = opt.zeroWidth.value();
- m_hasZeroHeight = opt.zeroHeight.value();
- m_isAnimation = opt.animated.value();
- m_isScaled = opt.scaleToFit.value();
- m_isTiled = opt.tiled.value();
+ bool scale = opt.scaleToFit.value(), tile = opt.tiled.value();
+ YGtkImageAlign align = CENTER_IMAGE_ALIGN;
+ if (tile)
+ align = TILE_IMAGE_ALIGN;
+ if (scale)
+ align = SCALE_IMAGE_ALIGN;
+ if (scale && tile)
+ y2warning ("YImage can't be scaled and tiled at the same time");
+ ygtk_image_set_props (YGTK_IMAGE (getWidget()), align, alt_text->value_cstr());
- if (m_hasZeroWidth || m_isScaled || m_isTiled)
+ bool zeroWidth = opt.zeroWidth.value(), zeroHeight = opt.zeroHeight.value();
+ if (zeroWidth || scale || tile)
setStretchable (YD_HORIZ, true);
- if (m_hasZeroHeight || m_isScaled || m_isTiled)
+ if (zeroHeight || scale || tile)
setStretchable (YD_VERT, true);
-
- if (m_isScaled && m_isTiled) {
- y2warning ("YImage can't be scaled and tiled at the same time");
- m_isTiled = false;
- }
-
- if (m_isAnimation)
- m_animation = NULL;
- else
- m_pixbuf = NULL;
-
- g_signal_connect (G_OBJECT (getWidget()), "expose-event",
- G_CALLBACK (expose_event_cb), this);
- gtk_widget_queue_draw (getWidget());
- }
-
- void loadImage (GdkPixbuf *pixbuf, const char *error_msg)
- {
- IMPL
- if (pixbuf == NULL) {
- g_warning ("Couldn't load image - %s", error_msg);
- return;
- }
-
- m_imageLoaded = true;
- m_pixbuf = pixbuf;
- gtk_widget_set_size_request (getWidget(), m_hasZeroWidth ? -1 : gdk_pixbuf_get_width (pixbuf),
- m_hasZeroHeight ? -1 : gdk_pixbuf_get_height (pixbuf));
- }
-
- void loadAnimation (GdkPixbufAnimation *pixbuf, const char *error_msg)
- {
- IMPL
- if (pixbuf == NULL) {
- g_warning ("Couldn't load animation - %s", error_msg);
- return;
- }
-
- m_imageLoaded = true;
- m_animation = new Animation;
- m_animation->pixbuf = pixbuf;
-
- m_animation->frame = NULL;
- advance_frame_cb (this);
-
- g_signal_connect (G_OBJECT (getWidget()), "expose-event",
- G_CALLBACK (expose_event_cb), this);
- gtk_widget_queue_draw (getWidget());
+ gtk_widget_set_size_request (getWidget(), zeroWidth ? 1 : -1, zeroHeight ? 1 : -1);
}
public:
YGImage (const YWidgetOpt &opt, YGWidget *parent,
const YCPString &filename_str, const YCPString &text)
: YImage (opt),
- YGWidget (this, parent, true, GTK_TYPE_DRAWING_AREA, NULL)
+ YGWidget (this, parent, true, YGTK_TYPE_IMAGE, NULL)
{
IMPL
- alt_text = g_strdup (text->value_cstr());
- initOptions (opt);
-
+ setProps (opt, text);
const char *filename = filename_str->value_cstr();
- GError *error = 0;
- if (m_isAnimation) {
- GdkPixbufAnimation *pixbuf;
- if (ygdk_mng_pixbuf_is_file_mng (filename))
- pixbuf = ygdk_mng_pixbuf_new_from_file (filename, &error);
- else
- pixbuf = gdk_pixbuf_animation_new_from_file (filename, &error);
- loadAnimation (pixbuf, error ? error->message : "(undefined)");
- }
- else {
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, &error);
- loadImage (pixbuf, error ? error->message : "(undefined)");
- }
+ bool animated = opt.animated.value();
+ ygtk_image_set_from_file (YGTK_IMAGE (getWidget()), filename, animated);
}
YGImage (const YWidgetOpt &opt, YGWidget *parent,
const YCPByteblock &byteblock, const YCPString &text)
: YImage (opt),
- YGWidget (this, parent, true, GTK_TYPE_DRAWING_AREA, NULL)
- {
- IMPL
- alt_text = g_strdup (text->value_cstr());
- initOptions (opt);
-
- GError *error = 0;
- if (m_isAnimation && ygdk_mng_pixbuf_is_data_mng (byteblock->value(), byteblock->size()))
- {
- GdkPixbufAnimation *pixbuf;
- pixbuf = ygdk_mng_pixbuf_new_from_data (byteblock->value(), byteblock->size(), &error);
- loadAnimation (pixbuf, error ? error->message : "(undefined)");
- }
- else
- {
- GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
- g_signal_connect (G_OBJECT (loader), "area-prepared",
- G_CALLBACK (image_loaded_cb), this);
-
- if (!gdk_pixbuf_loader_write (loader,
- byteblock->value(), byteblock->size(), &error))
- g_warning ("Could not load image from data blocks: %s", error->message);
- gdk_pixbuf_loader_close (loader, &error);
- }
- }
-
- virtual ~YGImage()
- {
- IMPL
- if (m_imageLoaded) {
- if (m_isAnimation) {
- g_object_unref (G_OBJECT (m_animation->pixbuf));
- if (m_animation->timeout_id)
- g_source_remove (m_animation->timeout_id);
- delete m_animation;
- }
- else
- g_object_unref (G_OBJECT (m_pixbuf));
- }
- g_free (alt_text);
- }
-
- // callback for image loading
- static void image_loaded_cb (GdkPixbufLoader *loader, YGImage *pThis)
- {
- IMPL
- if (pThis->m_isAnimation) {
- if (pThis->m_animation) {
- // a new frame loaded -- just redraw the widget
- if (gdk_pixbuf_animation_iter_on_currently_loading_frame
- (pThis->m_animation->frame))
- gtk_widget_queue_draw (pThis->getWidget());
- }
- else {
- GdkPixbufAnimation *pixbuf = gdk_pixbuf_loader_get_animation (loader);
- g_object_ref (G_OBJECT (pixbuf));
- pThis->loadAnimation (pixbuf, " on block data reading callback");
- }
- }
- else {
- GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- g_object_ref (G_OBJECT (pixbuf));
- pThis->loadImage (pixbuf, " on block data reading callback");
- }
- }
-
- // callback for image displaying
- static gboolean advance_frame_cb (void *pData)
- {
- IMPL
- YGImage *pThis = (YGImage *) pData;
- Animation *animation = pThis->m_animation;
-
- if (!animation->frame) // no frame yet loaded
- animation->frame = gdk_pixbuf_animation_get_iter (animation->pixbuf, NULL);
- else
- if (gdk_pixbuf_animation_iter_advance (animation->frame, NULL))
- gtk_widget_queue_draw (pThis->getWidget());
-
- // shedule next frame
- int delay = gdk_pixbuf_animation_iter_get_delay_time (animation->frame);
- if (delay != -1)
- animation->timeout_id = g_timeout_add (delay, advance_frame_cb, pThis);
-
- GdkPixbuf *pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (pThis->m_animation->frame);
- gtk_widget_set_size_request (pThis->getWidget(), gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf));
- return FALSE;
- }
-
- static gboolean expose_event_cb (GtkWidget *widget, GdkEventExpose *event,
- YGImage *pThis)
+ YGWidget (this, parent, true, YGTK_TYPE_IMAGE, NULL)
{
IMPL
- int x, y, width, height;
- x = widget->allocation.x + 6;
- y = widget->allocation.y + 6;
- width = widget->allocation.width;
- height = widget->allocation.height;
-
- cairo_t *cr = gdk_cairo_create (widget->window);
-
- if (!pThis->m_imageLoaded) {
- // show default text if no image was loaded
- PangoLayout *layout;
- layout = gtk_widget_create_pango_layout (widget, pThis->alt_text);
-
- int text_width, text_height;
- pango_layout_get_size (layout, &text_width, &text_height);
- text_width /= PANGO_SCALE;
- text_height /= PANGO_SCALE;
-
- x += (width - text_width) / 2;
- y += (height - text_height) / 2;
-
- cairo_move_to (cr, x, y);
- pango_cairo_show_layout (cr, layout);
-
- g_object_unref (layout);
- cairo_destroy (cr);
- return TRUE;
- }
-
- GdkPixbuf *pixbuf;
- if (pThis->m_isAnimation)
- pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (pThis->m_animation->frame);
- else
- pixbuf = pThis->m_pixbuf;
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
-
- if (pThis->m_isTiled)
- cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
-
- if (pThis->m_isScaled) {
- double scale_x = (double) gdk_pixbuf_get_width (pixbuf) / width;
- double scale_y = (double) gdk_pixbuf_get_height (pixbuf) / height;
- cairo_matrix_t matrix;
- cairo_matrix_init_scale (&matrix, scale_x, scale_y);
- cairo_pattern_set_matrix (cairo_get_source (cr), &matrix);
- }
-
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_fill (cr);
-
- cairo_destroy (cr);
- return TRUE;
+ setProps (opt, text);
+ const guint8 *data = byteblock->value();
+ long data_size = byteblock->size();
+ bool animated = opt.animated.value();
+ ygtk_image_set_from_data (YGTK_IMAGE (getWidget()), data, data_size, animated);
}
YGWIDGET_IMPL_COMMON
Modified: trunk/gtk/src/YGLayout.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=43212&r1…
==============================================================================
--- trunk/gtk/src/YGLayout.cc (original)
+++ trunk/gtk/src/YGLayout.cc Thu Dec 20 21:36:55 2007
@@ -96,7 +96,7 @@
YGWidget::sync_stretchable();
}
- virtual void moveChild (YWidget *, long, long) {}; // ignore
+ virtual void moveChild (YWidget *, long, long) {} // ignore
};
YContainerWidget *
Modified: trunk/gtk/src/YGMultiLineEdit.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGMultiLineEdit.cc?rev=4…
==============================================================================
--- trunk/gtk/src/YGMultiLineEdit.cc (original)
+++ trunk/gtk/src/YGMultiLineEdit.cc Thu Dec 20 21:36:55 2007
@@ -245,3 +245,146 @@
return new YGRichText (opt, YGWidget::get (parent), text);
}
+#if 0
+/* Wrote this code, in order to allow the user to print a package license.
+ But they are written in HTML, so that was too much for me. Anyway, might
+ be needed in the future -- it prints text okay. Maybe we could adapt it to
+ YGtkRichText, so that it just iterates through its tags (its a GtkTextView
+ afterall), rather than doing html parsing. ugh. Maybe we could somehow re-use
+ GtkTextView GtkLayouts...*/
+
+typedef struct {
+ gchar *title, *text;
+ PangoLayout *title_layout, *text_layout;
+ gint cur_line;
+} PrintData;
+
+
+static void free_print_data_cb (gpointer _data, GClosure *closure)
+{
+ PrintData *data = _data;
+fprintf (stderr, "freeing print data '%s'\n", data->title);
+ g_free (data->title);
+ g_free (data->text);
+ if (data->title_layout)
+ g_object_unref (G_OBJECT (data->title_layout));
+ if (data->text_layout)
+ g_object_unref (G_OBJECT (data->text_layout));
+ g_free (data);
+}
+
+static void print_begin_cb (GtkPrintOperation *print, GtkPrintContext *context, PrintData *data)
+{
+ int width = gtk_print_context_get_width (context);
+ int height = gtk_print_context_get_height (context);
+
+ PangoFontDescription *desc;
+ desc = pango_font_description_from_string ("Sans 12");
+
+ data->text_layout = gtk_print_context_create_pango_layout (context);
+ pango_layout_set_font_description (data->text_layout, desc);
+ pango_layout_set_width (data->text_layout, width * PANGO_SCALE);
+ pango_layout_set_text (data->text_layout, data->text, -1);
+
+ data->title_layout = gtk_print_context_create_pango_layout (context);
+ pango_layout_set_font_description (data->title_layout, desc);
+ pango_layout_set_width (data->title_layout, width * PANGO_SCALE);
+ pango_layout_set_text (data->title_layout, data->title, -1);
+
+ pango_font_description_free (desc);
+
+ int title_height, text_height;
+ pango_layout_get_pixel_size (data->title_layout, NULL, &title_height);
+ title_height += 10;
+ pango_layout_get_pixel_size (data->text_layout, NULL, &text_height);
+
+ int pages_nb, page_height = height - title_height;
+ pages_nb = text_height / page_height;
+ if (text_height % page_height != 0)
+ pages_nb++;
+ data->cur_line = 0;
+fprintf (stderr, "print begin: will use %d pages\n", pages_nb);
+ gtk_print_operation_set_n_pages (print, pages_nb);
+}
+
+static void print_draw_page_cb (GtkPrintOperation *print, GtkPrintContext *context,
+ gint page_nb, PrintData *data)
+{
+ int title_height;
+ pango_layout_get_pixel_size (data->title_layout, NULL, &title_height);
+ title_height += 10;
+
+ cairo_t *cr = gtk_print_context_get_cairo_context (context);
+ cairo_set_source_rgb (cr, 0, 0, 0);
+
+ cairo_move_to (cr, 6, 3);
+ pango_cairo_show_layout (cr, data->title_layout);
+
+ cairo_move_to (cr, 0, title_height-4);
+ cairo_line_to (cr, gtk_print_context_get_width (context), title_height-4);
+ cairo_stroke (cr);
+
+ int y = title_height, page_height = 0;
+ for (;; data->cur_line++) {
+fprintf (stderr, "printing line: %d\n", data->cur_line);
+ PangoLayoutLine *line = pango_layout_get_line_readonly (data->text_layout,
+ data->cur_line);
+ if (!line)
+{
+fprintf (stderr, "no more lines\n");
+ break;
+}
+ PangoRectangle rect;
+ pango_layout_line_get_pixel_extents (line, NULL, &rect);
+fprintf (stderr, "paragraph rect: %d x %d , %d x %d\n", rect.x, rect.y, rect.width, rect.height);
+ page_height += rect.height;
+ if (page_height >= gtk_print_context_get_height (context))
+{
+fprintf (stderr, "end of page: %f x %d\n", gtk_print_context_get_height (context), page_height);
+ break;
+}
+
+ cairo_move_to (cr, rect.x, y + rect.height);
+ pango_cairo_show_layout_line (cr, line);
+ y += rect.height;
+ }
+}
+
+void ygtk_html_print_text (GtkWindow *parent_window, const gchar *title, const gchar *text)
+{
+ PrintData *data = g_new (PrintData, 1);
+ data->title = g_strdup (title);
+ data->text = g_strdup (text);
+ data->title_layout = data->text_layout = NULL;
+
+ GtkPrintOperation *print = gtk_print_operation_new();
+
+ static GtkPrintSettings *print_settings = NULL;
+ if (print_settings)
+ gtk_print_operation_set_print_settings (print, print_settings);
+
+ g_signal_connect (G_OBJECT (print), "begin-print", G_CALLBACK (print_begin_cb), data);
+ g_signal_connect_data (G_OBJECT (print), "draw-page", G_CALLBACK (print_draw_page_cb),
+ data, free_print_data_cb, 0);
+
+ GError *error;
+ GtkPrintOperationResult res;
+ res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+ parent_window, &error);
+ if (res == GTK_PRINT_OPERATION_RESULT_ERROR) {
+ GtkWidget *dialog;
+ dialog = gtk_message_dialog_new (parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "<b>Print error</b>\n%s", error->message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ g_error_free (error);
+ }
+ if (res == GTK_PRINT_OPERATION_RESULT_APPLY) {
+ if (print_settings)
+ g_object_unref (print_settings);
+ print_settings = g_object_ref (gtk_print_operation_get_print_settings (print));
+ }
+}
+#endif
+
Modified: trunk/gtk/src/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev…
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Thu Dec 20 21:36:55 2007
@@ -2,2419 +2,1382 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-/*
- Textdomain "yast2-gtk"
-*/
-
#include <config.h>
#include <ycp/y2log.h>
-#include <YGUI.h>
+
+#include "YGUI.h"
#include "YGUtils.h"
#include "YGi18n.h"
#include "YGDialog.h"
-#include "YPackageSelector.h"
-#include "ygtkhtmlwrap.h"
+
#include "ygtkwizard.h"
-#include "ygtkcellrendererarrow.h"
-#include "ygtkratiobox.h"
#include "ygtkfindentry.h"
+#include "ygtkhtmlwrap.h"
+#include "ygtkzyppwrapper.h"
-#include <map>
-
-//#define DISABLE_PACKAGE_SELECTOR
-
-#ifndef DISABLE_PACKAGE_SELECTOR
-#include <zypp/ZYppFactory.h>
-#include <zypp/ResObject.h>
-#include <zypp/ResPoolProxy.h>
-#include <zypp/ui/Selectable.h>
-#include <zypp/Patch.h>
-#include <zypp/Selection.h>
-#include <zypp/Package.h>
-#include <zypp/Pattern.h>
-#include <zypp/Language.h>
-#include <zypp/Product.h>
-#ifdef PRE_ZYPP_3
-#include <zypp/Source.h>
-#include <zypp/SourceManager.h>
-#else
-#include <zypp/Repository.h>
-#include <zypp/RepoManager.h>
-#endif
+// utilities
+static GtkWidget *createImageFromXPM (const char **xpm)
+{
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (xpm);
+ GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_widget_show (image);
+ g_object_unref (pixbuf);
+ return image;
+}
-/* We should consider linking to libgnome and use gnome_url_show(url) here,
- or at least do some path finding. */
#define FILEMANAGER_EXEC "/usr/bin/nautilus"
-inline bool FILEMANAGER_PRESENT()
-{ return g_file_test (FILEMANAGER_EXEC, G_FILE_TEST_IS_EXECUTABLE); }
inline void FILEMANAGER_LAUNCH (const char *path)
-{ system ((string (FILEMANAGER_EXEC) + " " + path + " &").c_str()); }
+{ system ((std::string (FILEMANAGER_EXEC) + " -n --no-desktop " + path + " &").c_str()); }
-// some typedefs and functions to short Zypp names
-typedef zypp::ResPoolProxy ZyppPool;
-inline ZyppPool zyppPool() { return zypp::getZYpp()->poolProxy(); }
-typedef zypp::ui::Selectable::Ptr ZyppSelectable;
-typedef zypp::ui::Selectable* ZyppSelectablePtr;
-typedef zypp::ResObject::constPtr ZyppObject;
-typedef zypp::Package::constPtr ZyppPackage;
-typedef zypp::Patch::constPtr ZyppPatch;
-typedef zypp::Pattern::constPtr ZyppPattern;
-typedef zypp::Language::constPtr ZyppLanguage;
-inline ZyppPackage tryCastToZyppPkg (ZyppObject obj)
- { return zypp::dynamic_pointer_cast <const zypp::Package> (obj); }
-inline ZyppPatch tryCastToZyppPatch (ZyppObject obj)
- { return zypp::dynamic_pointer_cast <const zypp::Patch> (obj); }
-inline ZyppPattern tryCastToZyppPattern (ZyppObject obj)
- { return zypp::dynamic_pointer_cast <const zypp::Pattern> (obj); }
-inline ZyppLanguage tryCastToZyppLanguage (ZyppObject obj)
- { return zypp::dynamic_pointer_cast <const zypp::Language> (obj); }
-
-static zypp::Text
-fastGetSummary (ZyppObject obj)
+static void busyCursor()
{
- static std::map<std::string, zypp::Text> name_to_summary;
- std::string &summary = name_to_summary[ obj->name() ];
- if (summary.length() <= 0)
- summary = obj->summary();
- return summary;
+ YGUI::ui()->busyCursor();
+ // so that the cursor is actually set...
+ while (g_main_context_iteration (NULL, FALSE)) ;
}
+static void normalCursor()
+{ YGUI::ui()->normalCursor(); }
-// Computer icon comes from Tango, but may not be installed, or not initialized.
-#include "computer.xpm"
+#include "icons/pkg-list-mode.xpm"
+#include "icons/pkg-tiles-mode.xpm"
-static bool acceptLicense (ZyppSelectablePtr sel)
+class PackagesView
{
- if (sel->hasLicenceConfirmed())
- return true;
-
- ZyppObject object = sel->candidateObj();
- ZyppPackage package = tryCastToZyppPkg (object);
- if (!package)
- return true;
-
- const string &license = package->licenseToConfirm();
- if (license.empty()) {
- sel->setLicenceConfirmed (true);
- return true;
- }
-
- GtkWidget *dialog = gtk_dialog_new_with_buttons (_("License Agreement"),
- YGUI::ui()->currentWindow(), GTK_DIALOG_MODAL,
- _("_Reject"), GTK_RESPONSE_REJECT, _("_Accept"), GTK_RESPONSE_ACCEPT, NULL);
-
- GtkWidget *license_view, *license_window;
-
- license_view = ygtk_html_wrap_new();
- ygtk_html_wrap_set_text (license_view, license.c_str());
-
- license_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (license_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type
- (GTK_SCROLLED_WINDOW (license_window), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (license_window), license_view);
-
- GtkBox *vbox = GTK_BOX (GTK_DIALOG(dialog)->vbox);
- gtk_box_pack_start (vbox, license_window, TRUE, TRUE, 6);
-
- const char *print_text = _("If you would like to print this license, check the EULA.txt file on the first media");
- GtkLabel *print_label = GTK_LABEL (gtk_label_new (print_text));
- gtk_box_pack_start (vbox, GTK_WIDGET (print_label), FALSE, TRUE, 2);
-
- gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400);
- gtk_widget_show_all (dialog);
-
- bool confirmed = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
- gtk_widget_destroy (dialog);
-
- sel->setLicenceConfirmed (confirmed);
- return confirmed;
-}
+public:
+ struct Listener {
+ virtual void packagesSelected (const std::list <Ypp::Package *> &selection) = 0;
+ };
+ void setListener (Listener *listener)
+ { m_listener = listener; }
-// install / remove convinience wrapper. You only need to specify an object
-// if you want that particular version to be installed.
-// returns true on sucess
-static bool mark_selectable (ZyppSelectablePtr selectable, bool install /*or remove*/)
-{
- zypp::ui::Status status = selectable->status();
+private:
+Listener *m_listener;
- if (install) {
- if (!selectable->hasCandidateObj()) {
- y2warning ("YGPackageSelector: no package on repository to install");
- return false;
- }
- if (!acceptLicense (selectable))
- return false;
- if (status == zypp::ui::S_Del)
- status = zypp::ui::S_KeepInstalled;
- else {
- if (status == zypp::ui::S_KeepInstalled)
- status = zypp::ui::S_Update;
- else
- status = zypp::ui::S_Install;
+ void packagesSelected (const std::list <Ypp::Package *> &selection)
+ {
+ if (m_listener) {
+ busyCursor();
+ m_listener->packagesSelected (selection);
+ normalCursor();
}
}
- else /*remove*/ {
- if (status == zypp::ui::S_NoInst)
- ; // do nothing
- else if (status == zypp::ui::S_Install)
- status = zypp::ui::S_NoInst;
- else if (status == zypp::ui::S_Update)
- status = zypp::ui::S_KeepInstalled;
- else
- status = zypp::ui::S_Del;
- }
-
-#if 0 // debug
- const char *name = selectable->name().c_str();
- switch (status) {
- case zypp::ui::S_KeepInstalled:
- y2milestone ("keep %s installed\n", name);
- break;
- case zypp::ui::S_Update:
- y2milestone ("update %s\n", name);
- break;
- case zypp::ui::S_Install:
- y2milestone ("install %s\n", name);
- break;
- case zypp::ui::S_Del:
- y2milestone ("remove %s\n", name);
- break;
- case zypp::ui::S_NoInst:
- y2milestone ("don't install %s\n", name);
- break;
- default:
- y2milestone ("error: unknown action: should not happen\n");
- break;
- }
-#endif
-
- return selectable->set_status (status);
-}
-// tries to solve possible dependencies problems and asks the user for
-// manual resolution if needed (there is not much space for interface
-// design here)
-static bool solveProblems()
-{
- IMPL
- zypp::Resolver_Ptr resolver = zypp::getZYpp()->resolver();
- if (resolver->resolvePool())
- return true;
- zypp::ResolverProblemList problems = resolver->problems();
- if (problems.empty())
- return true;
-
- GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Resolve Problems"),
- YGUI::ui()->currentWindow(), GTK_DIALOG_MODAL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("C_onfirm"), GTK_RESPONSE_ACCEPT, NULL);
-
- GtkWidget *problems_view;
- problems_view = gtk_tree_view_new();
-
- GtkWidget *problems_window;
- problems_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (problems_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type
- (GTK_SCROLLED_WINDOW (problems_window), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (problems_window), problems_view);
-
- GtkBox *vbox = GTK_BOX (GTK_DIALOG(dialog)->vbox);
- gtk_box_pack_start (vbox, problems_window, TRUE, TRUE, 0);
-
- // create model
- // the vairous columns are: radio button active (boolean), problem
- // or solution description (string), is radio button (boolean: always
- // true), show radio button (boolean; false for problems)
- GtkTreeStore *problems_store = gtk_tree_store_new (4,
- G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
- // install view
- GtkTreeViewColumn *column;
- GtkCellRenderer *radio_renderer = gtk_cell_renderer_toggle_new();
- column = gtk_tree_view_column_new_with_attributes ("",
- radio_renderer, "active", 0, "radio", 2, "visible", 3, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (problems_view), column);
- g_signal_connect (G_OBJECT (radio_renderer), "toggled",
- G_CALLBACK (YGUtils::tree_view_radio_toggle_cb),
- GTK_TREE_MODEL (problems_store));
-
- column = gtk_tree_view_column_new_with_attributes (_("Problems"),
- gtk_cell_renderer_text_new(), "text", 1, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (problems_view), column);
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (problems_view), FALSE);
- gtk_tree_view_set_model (GTK_TREE_VIEW (problems_view),
- GTK_TREE_MODEL (problems_store));
- g_object_unref (G_OBJECT (problems_store));
-
- // construct model
- GtkTreeIter piter, siter;
- map <GtkTreePath *, zypp::ProblemSolution *> users_actions;
- for (zypp::ResolverProblemList::iterator it = problems.begin();
- it != problems.end(); it++) {
- zypp::ProblemSolutionList solutions = (*it)->solutions();
-
- gtk_tree_store_append (problems_store, &piter, NULL);
- gtk_tree_store_set (problems_store, &piter, 0, FALSE,
- 1, (*it)->description().c_str(), 2, TRUE, 3, FALSE, -1);
-
- for (zypp::ProblemSolutionList::iterator jt = solutions.begin();
- jt != solutions.end(); jt++) {
- gtk_tree_store_append (problems_store, &siter, &piter);
- gtk_tree_store_set (problems_store, &siter, 0, FALSE,
- 1, (*jt)->description().c_str(), 2, TRUE, 3, TRUE, -1);
- users_actions [gtk_tree_model_get_path (GTK_TREE_MODEL (
- problems_store), &siter)] = get_pointer (*jt);
- }
- }
-
- // set tree properties
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
- GTK_TREE_VIEW (problems_view)), GTK_SELECTION_NONE);
- gtk_tree_view_expand_all (GTK_TREE_VIEW (problems_view));
-
- gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400);
- gtk_widget_show_all (dialog);
-
- bool confirmed = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
-
- if (confirmed) {
- // apply user solutions
- zypp::ProblemSolutionList userChoices;
+ struct View {
+ PackagesView *m_parent;
+ GtkWidget *m_widget;
+ View (PackagesView *parent) : m_parent (parent)
+ {}
+ virtual void setModel (GtkTreeModel *model) = 0;
- GtkTreeIter iter;
- for (map <GtkTreePath *, zypp::ProblemSolution *>::iterator it
- = users_actions.begin(); it != users_actions.end(); it++) {
- gtk_tree_model_get_iter (GTK_TREE_MODEL (problems_store),
- &iter, it->first);
- gboolean state = FALSE;
- gtk_tree_model_get (GTK_TREE_MODEL (problems_store), &iter,
- 0, &state, -1);
- if (state)
- userChoices.push_back (it->second);
-
- gtk_tree_path_free (it->first);
- }
- resolver->applySolutions (userChoices);
- }
-
- gtk_widget_destroy (dialog);
- if (confirmed)
- // repeate the all process as things may not yet be solved
- return solveProblems();
- return false;
-}
+ void selectedPaths (GtkTreeModel *model, GList *paths)
+ {
+ std::list <Ypp::Package *> packages;
+ for (GList *i = paths; i; i = i->next) {
+ Ypp::Package *package;
+ GtkTreePath *path = (GtkTreePath *) i->data;
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, YGtkZyppModel::PTR_COLUMN, &package, -1);
+ gtk_tree_path_free (path);
-#ifdef PRE_ZYPP_3
-static string getSourceName (zypp::Source_Ref source)
-{ // based on yast-qt's singleProduct()
- if (!source.enabled())
- // can't get name if disabled; strangely, source.resolvables().begin()
- // hangs
- return "";
- string ret;
- bool found = false;
- for (zypp::ResStore::iterator it = source.resolvables().begin();
- it != source.resolvables().end(); it++) {
- zypp::Product::Ptr product;
- product = zypp::dynamic_pointer_cast <zypp::Product> (*it);
- if (product) {
- if (found) {
- y2milestone ("Multiple products on installation source %s",
- source.alias().c_str());
- return "";
- }
- found = true;
- ret = fastGetSummary (product);
+ packages.push_back (package);
+ }
+ g_list_free (paths);
+ m_parent->packagesSelected (packages);
}
- }
-
- if (!found)
- y2milestone ("No product on installation source %s",
- source.alias().c_str());
- return ret;
-}
-#endif
-
-#define PACKAGE_INFO_HEIGHT 140
-#define ADVANCED_INFO_HEIGHT 80
-
-// Expander widget with the package information
-class PackageInformation
-{
- GtkWidget *m_widget, *m_notebook;
- // Information text
- GtkWidget *m_about_text, *m_authors_text, *m_filelist_text, *m_changelog_text;
- bool m_use_filemanager;
-
-public:
- PackageInformation (const char *expander_text, bool only_description)
+ };
+ struct ListView : public View
{
- m_widget = gtk_expander_new (expander_text);
- gtk_widget_set_sensitive (m_widget, FALSE);
-
- if (only_description) {
- GtkWidget *about_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (about_win),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- m_about_text = ygtk_html_wrap_new();
- gtk_container_add (GTK_CONTAINER (about_win), m_about_text);
- gtk_container_add (GTK_CONTAINER (m_widget), about_win);
- m_authors_text = m_filelist_text = m_changelog_text = NULL;
- m_notebook = NULL;
- }
- else {
- m_notebook = gtk_notebook_new();
- gtk_notebook_set_tab_pos (GTK_NOTEBOOK (m_notebook), GTK_POS_BOTTOM);
- gtk_container_add (GTK_CONTAINER (m_widget), m_notebook);
-
- m_about_text = add_text_tab (m_notebook, _("Description"));
- m_filelist_text = add_text_tab (m_notebook, _("File List"));
- if ((m_use_filemanager = FILEMANAGER_PRESENT()))
- ygtk_html_wrap_connect_link_clicked (m_filelist_text,
- G_CALLBACK (dir_pressed_cb), NULL);
- m_changelog_text = add_text_tab (m_notebook, _("Change Log"));
- m_authors_text = add_text_tab (m_notebook, _("Authors"));
+ ListView (PackagesView *parent)
+ : View (parent)
+ {
+ GtkTreeView *view = GTK_TREE_VIEW (m_widget = gtk_tree_view_new());
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (view), 1);
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "pixbuf", YGtkZyppModel::ICON_COLUMN, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ renderer = gtk_cell_renderer_text_new();
+ g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "markup", YGtkZyppModel::NAME_DESCRIPTION_COLUMN, NULL);
+ gtk_tree_view_column_set_expand (column, TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "pixbuf", YGtkZyppModel::SPECIAL_ICON_COLUMN, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (packages_selected_cb), this);
+ gtk_widget_show (m_widget);
}
- gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (m_widget)),
- -1, PACKAGE_INFO_HEIGHT);
- }
- GtkWidget *getWidget()
- { return m_widget; }
+ virtual void setModel (GtkTreeModel *model)
+ {
+ gtk_tree_view_set_model (GTK_TREE_VIEW (m_widget), model);
+ if (GTK_WIDGET_REALIZED (m_widget))
+ gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (m_widget), 0, 0);
+ }
- void setPackage (ZyppSelectablePtr selectable, ZyppObject object)
+ static void packages_selected_cb (GtkTreeSelection *selection, View *pThis)
+ {
+ GtkTreeModel *model;
+ GList *paths = gtk_tree_selection_get_selected_rows (selection, &model);
+ pThis->selectedPaths (model, paths);
+ }
+ };
+ struct IconView : public View
{
- if (!selectable || !object) {
- if (m_about_text)
- set_text (m_about_text, "");
- if (m_filelist_text)
- set_text (m_filelist_text, "");
- if (m_changelog_text)
- set_text (m_changelog_text, "");
- if (m_authors_text)
- set_text (m_authors_text, "");
- gtk_expander_set_expanded (GTK_EXPANDER (m_widget), FALSE);
- gtk_widget_set_sensitive (m_widget, FALSE);
- return;
+ IconView (PackagesView *parent)
+ : View (parent)
+ {
+ GtkIconView *view = GTK_ICON_VIEW (m_widget = gtk_icon_view_new());
+ gtk_icon_view_set_text_column (view, YGtkZyppModel::NAME_COLUMN);
+ gtk_icon_view_set_pixbuf_column (view, YGtkZyppModel::ICON_COLUMN);
+ gtk_icon_view_set_selection_mode (view, GTK_SELECTION_MULTIPLE);
+ g_signal_connect (G_OBJECT (m_widget), "selection-changed",
+ G_CALLBACK (packages_selected_cb), this);
+ gtk_widget_show (m_widget);
}
- /* Keep notebook on first page; but only when not visible to not
- annoy the user. */
- if (m_notebook && !gtk_expander_get_expanded (GTK_EXPANDER (m_widget)))
- gtk_notebook_set_current_page (GTK_NOTEBOOK (m_notebook), 0);
- gtk_widget_set_sensitive (m_widget, TRUE);
-
- ZyppPackage package = tryCastToZyppPkg (object);
- if (m_about_text) {
- string description = YGUtils::escape_markup (object->description(), true);
-
- // cut authors, since they have their own section
- string::size_type pos = description.find ("Authors:");
- if (pos != string::npos)
- description.erase (pos, string::npos);
-
- string str;
- if (package) {
- description += "<br>";
- str = package->url();
- if (!str.empty())
- description += _("Website: ") + str + "<br>";
- str = package->license();
- if (!str.empty())
- description += _("License: ") + str + "<br>";
- description += _("Size: ") + object->size().asString() + "b<br>";
- }
-
-#ifdef PRE_ZYPP_3
- zypp::Source_Ref source = object->source();
- str = getSourceName (source);
- if (str.empty())
- str = source.url().asString();
- else
- str = str + " (" + source.url().asString() + ")";
-#else
- zypp::Repository repo = object->repository();
- str = repo.info().name();
-#endif
- if (!str.empty())
- description += _("Repository: ") + str;
+ virtual void setModel (GtkTreeModel *model)
+ {
+ gtk_icon_view_set_model (GTK_ICON_VIEW (m_widget), model);
+ if (GTK_WIDGET_REALIZED (m_widget)) {
+ GtkTreePath *path = gtk_tree_path_new_first();
+ gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (m_widget),
+ path, FALSE, 0, 0);
+ gtk_tree_path_free (path);
+ }
+ }
- set_text (m_about_text, description);
+ static void packages_selected_cb (GtkIconView *view, View *pThis)
+ {
+ GtkTreeModel *model = gtk_icon_view_get_model (view);
+ GList *paths = gtk_icon_view_get_selected_items (view);
+ pThis->selectedPaths (model, paths);
}
- if (package) {
- if (m_filelist_text) {
- string filelist;
- const std::list <string> &filenames = package->filenames();
- for (std::list <string>::const_iterator it = filenames.begin();
- it != filenames.end(); it++) {
- string file (*it);
- // don't show created dirs
- if (g_file_test (file.c_str(), G_FILE_TEST_IS_DIR))
- continue;
- // set the path as a link
- if (m_use_filemanager) {
- string::size_type pos = file.find_last_of ('/');
- if (pos != string::npos) { // should be always true
- string dirname (file, 0, pos+1);
- string basename (file, pos+1, string::npos);
- file = "<a href=" + dirname + ">" + dirname + "</a>" + basename;
- }
- }
- filelist += file + "<br>";
- }
- set_text (m_filelist_text, filelist);
- }
- if (m_changelog_text) {
- string text;
- const std::list <zypp::ChangelogEntry> &changelog = package->changelog();
- for (std::list <zypp::ChangelogEntry>::const_iterator it = changelog.begin();
- it != changelog.end(); it++) {
- string t = "<blockquote>" + YGUtils::escape_markup (it->text(), true) +
- "</blockquote>";
- text += "<p>" + it->date().asString() + ""
- + YGUtils::escape_markup (it->author()) + ":<br>"
- + t + "</p>";
- }
- set_text (m_changelog_text, text);
- }
- if (m_authors_text) {
- string packager (YGUtils::escape_markup (package->packager())), authors;
+ };
- const std::list <string> &authors_list = package->authors();
- if (!authors_list.empty()) {
- for (std::list <string>::const_iterator it = authors_list.begin();
- it != authors_list.end(); it++)
- authors += *it;
- }
- else {
-// TODO: stuff changed on YGUtils, descript. and this needs to be reviewd
- /* authors() should be the proper way to get authors, but it seems to
- be rarely used, instead packagers list them on the description. */
- string description (object->description());
-//std::cerr << "description: " << description << std::endl;
- string::size_type pos = description.find ("Authors:");
- if (pos != string::npos) {
- pos = description.find_first_not_of (
- '-', pos + sizeof ("Authors:") + 1);
-//std::cerr << "copy string from " << pos << std::endl;
- authors = string (description, pos, string::npos);
- authors = YGUtils::escape_markup (authors, true);
-//std::cerr << "authors: " << authors << std::endl;
- }
- }
+GtkWidget *m_box, *m_bin, *m_list_button, *m_icon_button;
+GtkTreeModel *m_model;
+View *m_view;
- string text;
- if (!packager.empty())
- text = _("Packaged by:") + ("<blockquote>" + packager) +
- "</blockquote>";
- if (!authors.empty()) {
- if (!packager.empty())
- text += "<br><br>";
- text += _("Developed by:") + ("<blockquote>" + authors) +
- "</blockquote>";
- }
- set_text (m_authors_text, text);
- }
- }
- else {
- if (m_filelist_text)
- set_text (m_filelist_text, "");
- if (m_changelog_text)
- set_text (m_changelog_text, "");
- if (m_authors_text)
- set_text (m_authors_text, "");
- }
- }
+public:
+ GtkWidget *getWidget()
+ { return m_box; }
-private:
- // auxiliaries to cut down on code
- static GtkWidget *add_text_tab (GtkWidget *notebook, const char *label)
+ PackagesView() : m_listener (NULL), m_model (NULL), m_view (NULL)
{
- GtkWidget *widget, *scroll_win;
- scroll_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_win),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- widget = ygtk_html_wrap_new();
- gtk_container_add (GTK_CONTAINER (scroll_win), widget);
+ m_bin = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (m_bin),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_bin),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), scroll_win,
- gtk_label_new (label));
- return widget;
+ GtkWidget *buttons = gtk_vbox_new (FALSE, 0), *image;
+ image = createImageFromXPM (pkg_list_mode_xpm);
+ m_list_button = gtk_toggle_button_new();
+ gtk_button_set_image (GTK_BUTTON (m_list_button), image);
+ image = createImageFromXPM (pkg_tiles_mode_xpm);
+ m_icon_button = gtk_toggle_button_new();
+ gtk_button_set_image (GTK_BUTTON (m_icon_button), image);
+ gtk_box_pack_start (GTK_BOX (buttons), gtk_label_new(""), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (buttons), m_list_button, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (buttons), m_icon_button, FALSE, FALSE, 0);
+ g_signal_connect (G_OBJECT (m_list_button), "toggled",
+ G_CALLBACK (mode_toggled_cb), this);
+ g_signal_connect (G_OBJECT (m_icon_button), "toggled",
+ G_CALLBACK (mode_toggled_cb), this);
+
+ m_box = gtk_hbox_new (FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (m_box), m_bin, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_box), buttons, FALSE, TRUE, 0);
+
+ setMode (LIST_MODE);
+ }
+
+ ~PackagesView()
+ {
+ if (m_model)
+ g_object_unref (G_OBJECT (m_model));
+ delete m_view;
}
- static void set_text (GtkWidget *widget, const string &text)
+ enum ViewMode {
+ LIST_MODE, ICON_MODE
+ };
+ void setMode (ViewMode mode)
{
- const char *str = _("<i>(not available)</i>");
- if (!text.empty())
- str = text.c_str();
- ygtk_html_wrap_set_text (widget, str);
- ygtk_html_wrap_scroll (widget, TRUE); // scroll to the start
+ if (GTK_WIDGET_REALIZED (m_bin))
+ busyCursor();
+ g_signal_handlers_block_by_func (m_list_button, (gpointer) mode_toggled_cb, this);
+ g_signal_handlers_block_by_func (m_icon_button, (gpointer) mode_toggled_cb, this);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_list_button), mode == LIST_MODE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_icon_button), mode == ICON_MODE);
+
+ g_signal_handlers_unblock_by_func (m_list_button, (gpointer) mode_toggled_cb, this);
+ g_signal_handlers_unblock_by_func (m_icon_button, (gpointer) mode_toggled_cb, this);
+
+ if (m_view)
+ gtk_container_remove (GTK_CONTAINER (m_bin), m_view->m_widget);
+ delete m_view;
+ if (mode == LIST_MODE)
+ m_view = new ListView (this);
+ else
+ m_view = new IconView (this);
+fprintf (stderr, "adding new view to container\n");
+ gtk_container_add (GTK_CONTAINER (m_bin), m_view->m_widget);
+ if (m_model)
+ m_view->setModel (m_model);
+ packagesSelected (std::list <Ypp::Package *> ());
+ normalCursor();
+ }
+
+ void query (Ypp::Query *query)
+ {
+ if (GTK_WIDGET_REALIZED (m_bin))
+ busyCursor();
+
+ if (m_model)
+ g_object_unref (G_OBJECT (m_model));
+
+ YGtkZyppModel *zmodel = ygtk_zypp_model_new (query);
+ m_model = GTK_TREE_MODEL (zmodel);
+ if (m_view) {
+ m_view->setModel (m_model);
+ packagesSelected (std::list <Ypp::Package *> ());
+ }
+ normalCursor();
}
- /* When a directory is pressed on the file list. */
- static void dir_pressed_cb (GtkWidget *text, const gchar *link)
- { FILEMANAGER_LAUNCH (link); }
+private:
+ static void mode_toggled_cb (GtkToggleButton *toggle, PackagesView *pThis)
+ {
+ bool active = gtk_toggle_button_get_active (toggle);
+ if (!active) {
+ // don't let the button be un-pressed
+ g_signal_handlers_block_by_func (toggle, (gpointer) mode_toggled_cb, pThis);
+ gtk_toggle_button_set_active (toggle, TRUE);
+ g_signal_handlers_unblock_by_func (toggle, (gpointer) mode_toggled_cb, pThis);
+ return;
+ }
+ ViewMode mode = GTK_WIDGET (toggle) == pThis->m_list_button ? LIST_MODE : ICON_MODE;
+ pThis->setMode (mode);
+ }
};
-// Table widget with package sources
- /* I don't like this, since it differs from the rest of the code, but to
- avoid declarations... */
- struct SourcesTableListener
- {
- virtual ~SourcesTableListener() {}
- virtual void sources_changed_cb() = 0;
- };
-class SourcesTable
+// TEMP: a window of modified packages
+class TrashWindow : PackagesView::Listener
{
- GtkWidget *m_widget;
- GtkTreeModel *m_model;
- SourcesTableListener *m_listener;
+GtkWidget *m_window, *m_undo_button;
+PackagesView *m_view;
public:
- SourcesTable (SourcesTableListener *listener)
- : m_listener (listener)
+ TrashWindow()
{
- /* 0 - source enabled?, 1 - source name (estimation), 2 - source URL,
- 3 - source id; what they call of alias. */
- GtkListStore *store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING);
- m_model = GTK_TREE_MODEL (store);
-
-#ifdef PRE_ZYPP_3
- zypp::SourceManager_Ptr manager = zypp::SourceManager::sourceManager();
- for (zypp::SourceManager::Source_const_iterator it = manager->Source_begin();
- it != manager->Source_end(); it++) {
- zypp::Source_Ref src = *it;
- if (src && src.enabled()) {
- GtkTreeIter iter;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, src.enabled(),
- 1, getSourceName (src).c_str(), 2, src.url().asString().c_str(),
- 3, src.alias().c_str(), -1);
- }
- }
-#else
- zypp::RepoManager manager;
- std::list <zypp::RepoInfo> repos = manager.knownRepositories();
- for (std::list <zypp::RepoInfo>::iterator it = repos.begin();
- it != repos.end(); it++) {
- if (it->enabled()) {
- GtkTreeIter iter;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, bool(it->enabled()),
- 1, it->name().c_str(), 2, it->alias().c_str(), -1);
- }
- }
-#endif
-
- GtkWidget *view = gtk_tree_view_new_with_model (m_model);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
- gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view), FALSE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)),
- GTK_SELECTION_NONE);
- g_object_unref (G_OBJECT (m_model)); // tree view will take care of it
-
- // prepare the view
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
-
- renderer = gtk_cell_renderer_toggle_new();
- column = gtk_tree_view_column_new_with_attributes ("",
- renderer, "active", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
- g_signal_connect (G_OBJECT (renderer), "toggled",
- G_CALLBACK (source_toggled_cb), this);
-
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes ("",
- renderer, "text", 1, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
-
-#ifdef PRE_ZYPP_3
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes ("",
- renderer, "text", 2, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
-#endif
-
- m_widget = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_widget),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_widget_set_size_request (m_widget, -1, ADVANCED_INFO_HEIGHT);
- gtk_container_add (GTK_CONTAINER (m_widget), view);
+ m_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (m_window), "Changes");
+ gtk_window_set_default_size (GTK_WINDOW (m_window), 200, 250);
+
+ m_view = new PackagesView();
+ Ypp::Query *query = new Ypp::Query (Ypp::Package::PACKAGE_TYPE);
+ query->setIsModified (true);
+ m_view->query (query);
+ m_view->setListener (this);
+
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 6), *undo_align;
+ m_undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
+ gtk_widget_set_sensitive (m_undo_button, FALSE);
+ g_signal_connect (G_OBJECT (m_undo_button), "clicked",
+ G_CALLBACK (undo_clicked_cb), this);
+ undo_align = gtk_alignment_new (1, 0, 0, 0);
+ gtk_container_add (GTK_CONTAINER (undo_align), m_undo_button);
+
+ gtk_box_pack_start (GTK_BOX (vbox), m_view->getWidget(), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), undo_align, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (m_window), vbox);
+ gtk_widget_show_all (m_window);
}
- GtkWidget *getWidget()
- { return m_widget; }
-
-private:
- static void source_toggled_cb (GtkCellRendererToggle *renderer,
- gchar *path_str, SourcesTable *pThis)
+ ~TrashWindow()
{
- IMPL
- GtkTreeModel *model = pThis->m_model;
- GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
- GtkTreeIter iter;
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_path_free (path);
-
-#ifdef PRE_ZYPP_3
- gchar *alias;
- gtk_tree_model_get (model, &iter, 3, &alias, -1);
-
- zypp::SourceManager_Ptr manager = zypp::SourceManager::sourceManager();
- zypp::Source_Ref source = manager->findSource (alias);
- g_free (alias);
-
- if (gtk_cell_renderer_toggle_get_active (renderer))
- source.disable();
- else
- source.enable();
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- 0, source.enabled(), -1);
-#else
- gchar *alias;
- gtk_tree_model_get (model, &iter, 2, &alias, -1);
-
- zypp::RepoManager manager;
- zypp::RepoInfo repo = manager.getRepositoryInfo (alias);
- g_free (alias);
+ delete m_view;
+ gtk_widget_destroy (m_window);
+ }
- bool enable = !gtk_cell_renderer_toggle_get_active (renderer);
- repo.setEnabled (enable);
+private:
+std::list <Ypp::Package *> m_selection;
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- 0, bool (repo.enabled()), -1);
-#endif
+ virtual void packagesSelected (const std::list <Ypp::Package *> &selection)
+ {
+ gtk_widget_set_sensitive (m_undo_button, !selection.empty());
+ m_selection = selection;
+ }
- pThis->m_listener->sources_changed_cb();
+ static void undo_clicked_cb (GtkButton *button, TrashWindow *pThis)
+ {
+ for (std::list <Ypp::Package *>::iterator it = pThis->m_selection.begin();
+ it != pThis->m_selection.end(); it++)
+ (*it)->undo();
}
};
-// Table widget to monitor disk partitions space-usage
-#define MIN_FREE_MB_WARN (80*1024)
+#include "icons/cat-development.xpm"
+#include "icons/cat-documentation.xpm"
+#include "icons/cat-emulators.xpm"
+#include "icons/cat-games.xpm"
+#include "icons/cat-hardware.xpm"
+#include "icons/cat-network.xpm"
+#include "icons/cat-multimedia.xpm"
+#include "icons/cat-office.xpm"
+#include "icons/cat-system.xpm"
+#include "icons/cat-utilities.xpm"
-class DiskTable
+class Filters
{
- GtkWidget *m_widget;
- GtkTreeModel *m_model;
- bool m_has_warned; // only warn once
-
- // evil long names
- typedef zypp::DiskUsageCounter::MountPoint ZyppDu;
- typedef zypp::DiskUsageCounter::MountPointSet ZyppDuSet;
- typedef zypp::DiskUsageCounter::MountPointSet::iterator ZyppDuSetIterator;
-
public:
- DiskTable()
- {
- m_has_warned = false;
- if (zypp::getZYpp()->diskUsage().empty())
- zypp::getZYpp()->setPartitions (
- zypp::DiskUsageCounter::detectMountPoints());
-
- /* 0 - mount point (also used as id), 1 - percentage of disk usage
- ([0, 100]), 2 - disk usage detail (i.e. "200Mb of 1Gb") */
- GtkListStore *store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_INT,
- G_TYPE_STRING);
- m_model = GTK_TREE_MODEL (store);
- update();
-
- GtkWidget *view = gtk_tree_view_new_with_model (m_model);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
- gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view), FALSE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)),
- GTK_SELECTION_NONE);
- g_object_unref (G_OBJECT (m_model)); // tree view will take care of it
-
- // prepare the view
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
-
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes (_("Mount Point"),
- renderer, "text", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
-
- renderer = gtk_cell_renderer_progress_new();
- column = gtk_tree_view_column_new_with_attributes (_("Usage"),
- renderer, "value", 1, "text", 2, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ struct Listener {
+ virtual void doQuery (Ypp::Query *query) = 0;
+ };
+ void setListener (Listener *listener)
+ { m_listener = listener; signalChanged(); }
- m_widget = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_widget),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_widget_set_size_request (m_widget, -1, ADVANCED_INFO_HEIGHT);
- gtk_container_add (GTK_CONTAINER (m_widget), view);
- }
+private:
+ GtkWidget *m_widget, *m_name, *m_status, *m_categories, *m_repos, *m_type,
+ *m_categories_expander, *m_repos_expander;
+ Listener *m_listener;
+ guint timeout_id;
+ int repoToggled; // how many repos are toggled? if 0, it can speed up query
+ int packageType;
+public:
GtkWidget *getWidget()
{ return m_widget; }
- static string sizeToString (long long size)
+ Filters()
+ : m_listener (NULL), timeout_id (0), repoToggled (0), packageType (-1)
{
- zypp::ByteCount count (size, zypp::ByteCount::K);
- return count.asString();
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 4);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
+ GtkSizeGroup *size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+ m_name = ygtk_find_entry_new();
+ g_signal_connect_after (G_OBJECT (m_name), "changed",
+ G_CALLBACK (entry_changed_cb), this);
+ gtk_box_pack_start (GTK_BOX (vbox),
+ labelWidget (_("Name: "), m_name, size_group), FALSE, TRUE, 0);
+
+ m_status = gtk_combo_box_new_text();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("All"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("Installed"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("Upgradable"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("Available"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_status), _("Modified"));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_status), 0);
+ g_signal_connect_after (G_OBJECT (m_status), "changed",
+ G_CALLBACK (combo_changed_cb), this);
+ gtk_box_pack_start (GTK_BOX (vbox),
+ labelWidget (_("Status: "), m_status, size_group), FALSE, TRUE, 0);
+
+ gtk_box_pack_start (GTK_BOX (vbox), buildCategories(), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), buildRepos(), FALSE, TRUE, 0);
+
+ m_type = gtk_combo_box_new_text();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Packages"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Patterns"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Languages"));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_type), 0);
+ g_signal_connect_after (G_OBJECT (m_type), "changed",
+ G_CALLBACK (combo_changed_cb), this);
+ gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (""), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox),
+ labelWidget (_("Type: "), m_type, size_group), FALSE, TRUE, 0);
+
+ m_widget = gtk_notebook_new();
+ gtk_notebook_append_page (GTK_NOTEBOOK (m_widget), vbox,
+ gtk_label_new (_("Filters")));
+ g_object_unref (G_OBJECT (size_group));
}
- void update()
+ ~Filters()
{
- GtkListStore *store = GTK_LIST_STORE (m_model);
- gtk_list_store_clear (store);
-
- bool warning = false;
- ZyppDuSet diskUsage = zypp::getZYpp()->diskUsage();
- for (ZyppDuSetIterator it = diskUsage.begin(); it != diskUsage.end(); it++) {
- const ZyppDu &partition = *it;
- if (!partition.readonly) {
- // partition fields: dir, used_size, total_size (size on Kb)
- GtkTreeIter iter;
- gtk_list_store_append (store, &iter);
-
- long usage = (partition.pkg_size * 100) / (partition.total_size + 1);
- string usage_str = sizeToString (partition.pkg_size) + " (of " +
- sizeToString (partition.total_size) + ")";
- gtk_list_store_set (store, &iter, 0, partition.dir.c_str(),
- 1, usage, 2, usage_str.c_str(), -1);
-
- warning = warning ||
- (partition.total_size > 1024 &&
- partition.total_size - partition.pkg_size < MIN_FREE_MB_WARN);
- }
- }
- if (warning)
- warn();
+ if (timeout_id) g_source_remove (timeout_id);
}
- void warn()
+private:
+ static void entry_changed_cb (GtkEditable *editable, Filters *pThis)
+ { pThis->signalChangedDelay(); }
+ static void combo_changed_cb (GtkComboBox *combo, Filters *pThis)
+ { pThis->signalChanged(); }
+
+ void signalChanged()
{
- if (m_has_warned)
- return;
- m_has_warned = true;
+ if (!m_listener) return;
- GtkWidget *dialog, *view, *scroll_view;
- dialog = gtk_message_dialog_new_with_markup (YGUI::ui()->currentWindow(),
- GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK, _("<b>Disk Almost Full !</b>\n\n"
- "One of the partitions is reaching its limit of capacity. You may "
- "have to remove packages if you wish to install some."));
+ Ypp::Package::Type type;
+ switch (gtk_combo_box_get_active (GTK_COMBO_BOX (m_type)))
+ {
+ case 0: default: type = Ypp::Package::PACKAGE_TYPE; break;
+ case 1: type = Ypp::Package::PATTERN_TYPE; break;
+ case 2: type = Ypp::Package::LANGUAGE_TYPE; break;
+
+ }
- view = gtk_tree_view_new_with_model (m_model);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
- gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view), FALSE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)),
- GTK_SELECTION_NONE);
+ Ypp::Query *query = new Ypp::Query (type);
- GtkTreeViewColumn *column;
- column = gtk_tree_view_column_new_with_attributes (_("Mount Point"),
- gtk_cell_renderer_text_new(), "text", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
- column = gtk_tree_view_column_new_with_attributes (_("Usage"),
- gtk_cell_renderer_progress_new(),
- "value", 1, "text", 2, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ const char *name = gtk_entry_get_text (GTK_ENTRY (m_name));
+ if (*name)
+ query->setName (std::string (name));
+ switch (gtk_combo_box_get_active (GTK_COMBO_BOX (m_status)))
+ {
+ case 1: query->setIsInstalled (true); break;
+ case 2: query->setHasUpgrade (true); break;
+ case 3: query->setIsInstalled (false); break;
+ case 4: query->setIsModified (true); break;
+ case 0: default: break;
+
+ }
- scroll_view = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_view),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_widget_set_size_request (scroll_view, -1, 80);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll_view),
- GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (scroll_view), view);
- gtk_widget_show_all (scroll_view);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll_view);
+ {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (m_categories));
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ Ypp::Node *category;
+ gtk_tree_model_get (model, &iter, 1, &category, -1);
+ if (category)
+ query->setCategory (category);
+ }
+ }
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- }
-};
+ if (repoToggled) {
+ std::list <int> reposQuery;
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (m_repos));
+ GtkTreeIter iter;
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ do {
+ gboolean enabled;
+ gint repo;
+ gtk_tree_model_get (model, &iter, 0, &enabled, 2, &repo, -1);
+ if (enabled)
+ reposQuery.push_back (repo);
+ } while (gtk_tree_model_iter_next (model, &iter));
+ }
+ query->setRepositories (reposQuery);
+ }
-// YOU patch selector
-class YGPatchSelector : public YPackageSelector, public YGWidget
-{
- GtkWidget *m_patches_view;
- GtkTreeModel *m_patches_model; // GtkListStore type
+ m_listener->doQuery (query);
+ updateCategories (type);
+ }
- // Package information widget
- PackageInformation *m_information_widget;
+ void signalChangedDelay()
+ {
+ struct inner {
+ static gboolean timeout_cb (gpointer data)
+ {
+ Filters *pThis = (Filters *) data;
+ pThis->timeout_id = 0;
+ pThis->signalChanged();
+ return FALSE;
+ }
+ };
+ if (timeout_id) g_source_remove (timeout_id);
+ timeout_id = g_timeout_add (500, inner::timeout_cb, this);
+ }
-public:
- YGPatchSelector (const YWidgetOpt &opt, YGWidget *parent)
- : YPackageSelector (opt),
- YGWidget (this, parent, true, YGTK_TYPE_WIZARD, NULL)
+ void updateCategories (Ypp::Package::Type type)
{
- setBorder (0);
- GtkWidget *main_vbox = gtk_vbox_new (FALSE, 0);
+ if (packageType == type)
+ return;
+ packageType = type;
- YGtkWizard *wizard = YGTK_WIZARD (getWidget());
- ygtk_wizard_set_child (YGTK_WIZARD (getWidget()), main_vbox);
- GtkWindow *window = YGUI::ui()->currentWindow();
- ygtk_wizard_set_header_text (wizard, window, _("Patch Selector"));
- ygtk_wizard_set_header_icon (wizard, window,
- THEMEDIR "/icons/32x32/apps/yast-software.png");
- ygtk_wizard_set_help_text (wizard,
- _("For information on a given patch, just press it and as well as the "
- "Package Information expander to make those informations visible.<br>"
- "To install a patch you just need to press the check button next to it "
- "and then the button Install when you are done.")
- );
- ygtk_wizard_set_next_button_label (wizard, _("_Install"));
- ygtk_wizard_set_next_button_id (wizard, g_strdup ("install"), g_free);
- ygtk_wizard_set_abort_button_label (wizard, _("_Cancel"));
- ygtk_wizard_set_abort_button_id (wizard, g_strdup ("cancel"), g_free);
- g_signal_connect (G_OBJECT (getWidget()), "action-triggered",
- G_CALLBACK (wizard_action_cb), this);
+ GtkTreeModel *model = NULL;
- m_patches_view = gtk_tree_view_new();
- GtkWidget *patches_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type
- (GTK_SCROLLED_WINDOW (patches_window), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (patches_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (patches_window), m_patches_view);
-
- m_information_widget = new PackageInformation (_("Patch Information"), true);
- GtkWidget *pkg_info_widget = m_information_widget->getWidget();
-
- gtk_box_pack_start (GTK_BOX (main_vbox), patches_window, TRUE, TRUE, 6);
- gtk_box_pack_start (GTK_BOX (main_vbox), pkg_info_widget, FALSE, FALSE, 6);
- gtk_widget_show_all (main_vbox);
-
- // Create a model for the patches lists
- // models' columns: selected radio button state (boolean),
- // package name (string), patch priority (string), selectable object (pointer)
- m_patches_model = GTK_TREE_MODEL (gtk_list_store_new
- (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER));
+ if (type == Ypp::Package::PACKAGE_TYPE) {
+ struct inner {
+ static void populate (GtkTreeStore *store, GtkTreeIter *parent,
+ Ypp::Node *category)
+ {
+ if (!category)
+ return;
+ GtkTreeIter iter;
+ gtk_tree_store_append (store, &iter, parent);
+ const std::string &name = category->name;
+ gtk_tree_store_set (store, &iter, 0, name.c_str(), 1, category, -1);
+ if (!parent) {
+ const char **icon = 0;
+ if (name == "Development")
+ icon = cat_development_xpm;
+ else if (name == "Documentation")
+ icon = cat_documentation_xpm;
+ else if (name == "Emulators")
+ icon = cat_emulators_xpm;
+ else if (name == "Games")
+ icon = cat_games_xpm;
+ else if (name == "Hardware")
+ icon = cat_hardware_xpm;
+ else if (name == "Multimedia")
+ icon = cat_multimedia_xpm;
+ else if (name == "Network")
+ icon = cat_network_xpm;
+ else if (name == "Office")
+ icon = cat_office_xpm;
+ else if (name == "System")
+ icon = cat_system_xpm;
+ else if (name == "Utilities")
+ icon = cat_utilities_xpm;
+ if (icon) {
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (icon);
+ gtk_tree_store_set (store, &iter, 2, pixbuf, -1);
+ }
+ }
+ populate (store, &iter, category->child());
+ populate (store, parent, category->next());
+ }
+ };
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer = gtk_cell_renderer_toggle_new();
- column = gtk_tree_view_column_new_with_attributes ("", renderer,
- "active", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (m_patches_view), column);
- g_signal_connect (G_OBJECT (renderer), "toggled",
- G_CALLBACK (patch_toggled_cb), this);
+ GtkTreeStore *store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_POINTER,
+ GDK_TYPE_PIXBUF);
+ model = GTK_TREE_MODEL (store);
- column = gtk_tree_view_column_new_with_attributes (_("Priority"),
- gtk_cell_renderer_text_new(), "text", 1, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (m_patches_view), column);
-
- column = gtk_tree_view_column_new_with_attributes (_("Name"),
- gtk_cell_renderer_text_new(), "text", 2, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (m_patches_view), column);
-
- for (ZyppPool::const_iterator it = zyppPool().byKindBegin <zypp::Patch>();
- it != zyppPool().byKindEnd <zypp::Patch>(); it++) {
- ZyppSelectable selectable = *it;
- ZyppPatch patch = tryCastToZyppPatch (selectable->theObj());
- if (!patch)
- continue;
- bool displayPatch = false;
-
- // These rules are taken from YQPkgPatchList::fillList() in the RelevantPatches case
- if (selectable->hasInstalledObj()) { // installed?
- if (selectable->installedPoolItem().status().isIncomplete()) { // patch broken?
- // The patch is broken: It had been installed, but the user somehow
- // downgraded individual packages belonging to the patch to older versions.
- displayPatch = true;
-
- y2warning( "Installed patch is broken: %s - %s",
- patch->name().c_str(),
- patch->summary().c_str() );
- }
- } else { // not installed
- if (selectable->hasCandidateObj() && selectable->candidatePoolItem().status().isSatisfied()) {
- // This is a pretty exotic case, but still it might happen:
- //
- // The patch itelf is not installed, but it is satisfied because the
- // user updated all the packages belonging to the patch to the versions
- // the patch requires. All that is missing now is to get the patch meta
- // data onto the system. So let's display the patch to give the user
- // a chance to install it (if he so chooses).
-
- displayPatch = true;
-
- y2milestone( "Patch satisfied, but not installed yet: %s - %s",
- patch->name().c_str(),
- patch->summary().c_str() );
- }
- }
+ GtkTreeIter iter;
+ gtk_tree_store_append (store, &iter, NULL);
+ gtk_tree_store_set (store, &iter, 0, _("All"), 1, NULL, -1);
- if (selectable->hasCandidateObj()) { // candidate available?
- // The most common case: There is a candidate patch, i.e. one that could be
- // installed, but either no version of that patch is installed or there is a
- // newer one to which the patch could be updated.
-
- if (selectable->candidatePoolItem().status().isNeeded()) { // patch really needed?
- // Patches are needed if any of the packages that belong to the patch
- // are installed on the system.
-
- displayPatch = true;
- } else {
- // None of the packages that belong to the patch is installed on the system.
-
- y2debug( "Patch not needed: %s - %s",
- patch->name().c_str(),
- patch->summary().c_str() );
- }
- }
+ inner::populate (store, NULL, Ypp::get()->getFirstCategory (type));
- if (displayPatch) {
- // select them all
- selectable->set_status (zypp::ui::S_Install);
+ }
+ else if (type == Ypp::Package::PATTERN_TYPE) {
+ GtkListStore *store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_POINTER,
+ GDK_TYPE_PIXBUF);
+ model = GTK_TREE_MODEL (store);
- GtkTreeIter iter;
- GtkListStore *store = GTK_LIST_STORE (m_patches_model);
+ GtkTreeIter iter;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, _("All"), 1, NULL, -1);
+
+ for (Ypp::Node *i = Ypp::get()->getFirstCategory (type); i; i = i->next()) {
gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, selectable->toInstall(),
- 1, patch->category().c_str(), 2, selectable->name().c_str(),
- 3, get_pointer (selectable), -1);
+ gtk_list_store_set (store, &iter, 0, i->name.c_str(), 1, i, -1);
}
}
- gtk_tree_view_set_model (GTK_TREE_VIEW (m_patches_view), m_patches_model);
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (m_categories));
+ g_signal_handlers_block_by_func (selection,
+ (gpointer) categories_selection_cb, this);
- // TODO: severity should be sort by severity, not alphabetically
- YGUtils::tree_view_set_sortable (GTK_TREE_VIEW (m_patches_view), 1);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (m_categories), model);
+ if (model) {
+ g_object_unref (G_OBJECT (model));
+ gtk_widget_show (m_categories_expander);
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_patches_view), 2);
+ /* we use gtk_tree_view_set_cursor(), rather than gtk_tree_selection_select_iter()
+ because that one is buggy in that when the user first interacts with the treeview,
+ a change signal is sent, even if he was just expanding one node... */
+ GtkTreePath *path = gtk_tree_path_new_first();
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (m_categories), path, NULL, FALSE);
+ gtk_tree_path_free (path);
+ }
+ else
+ gtk_widget_hide (m_categories_expander);
- g_signal_connect (G_OBJECT (m_patches_view), "cursor-changed",
- G_CALLBACK (patch_clicked_cb), this);
+ g_signal_handlers_unblock_by_func (selection,
+ (gpointer) categories_selection_cb, this);
}
- virtual ~YGPatchSelector()
+ GtkWidget *buildCategories()
{
- IMPL
- g_object_unref (m_patches_model);
- delete m_information_widget;
+ GtkWidget *scroll;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+
+ m_categories = gtk_tree_view_new();
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (m_categories), FALSE);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_categories), 0);
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes ("",
+ renderer, "pixbuf", 2, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (m_categories), column);
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes ("",
+ renderer, "text", 0, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (m_categories), column);
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (m_categories));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (categories_selection_cb), this);
+
+ scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_size_request (scroll, -1, 200);
+ gtk_container_add (GTK_CONTAINER (scroll), m_categories);
+
+ m_categories_expander = gtk_expander_new (_("Categories"));
+ gtk_container_add (GTK_CONTAINER (m_categories_expander), scroll);
+ gtk_expander_set_expanded (GTK_EXPANDER (m_categories_expander), TRUE);
+ return m_categories_expander;
}
- static ZyppSelectablePtr selectedPatch (GtkTreeView *tree_view)
+ GtkWidget *buildRepos()
{
- IMPL
- GtkTreePath *path;
+ GtkWidget *scroll;
+ GtkListStore *store;
GtkTreeViewColumn *column;
- gtk_tree_view_get_cursor (tree_view, &path, &column);
- if (path) {
- GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
+ GtkCellRenderer *renderer;
- ZyppSelectablePtr selectable = 0;
+ // 0 - enabled, 1 - name, 2 - ptr
+ store = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_INT);
+ for (int i = 0; Ypp::get()->getRepository (i); i++) {
+ const Ypp::Repository *repo = Ypp::get()->getRepository (i);
GtkTreeIter iter;
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, 3, &selectable, -1);
-
- gtk_tree_path_free (path);
- return selectable;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, TRUE, 1, repo->name.c_str(), 2, i, -1);
}
- return NULL;
- }
+ m_repos = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (m_repos), FALSE);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_repos), 1);
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (m_repos)),
+ GTK_SELECTION_NONE);
+ g_object_unref (G_OBJECT (store));
+ renderer = gtk_cell_renderer_toggle_new();
+ column = gtk_tree_view_column_new_with_attributes ("", renderer, "active", 0, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (m_repos), column);
+ g_signal_connect (G_OBJECT (renderer), "toggled",
+ G_CALLBACK (repo_toggled_cb), this);
+ g_signal_connect (G_OBJECT (m_repos), "row-activated",
+ G_CALLBACK (repo_clicked_cb), this);
+ renderer = gtk_cell_renderer_text_new();
+ g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ column = gtk_tree_view_column_new_with_attributes ("",
+ renderer, "text", 1, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (m_repos), column);
- // callbacks
- static void patch_clicked_cb (GtkTreeView *tree_view, YGPatchSelector *pThis)
- {
- IMPL
- ZyppSelectablePtr sel = selectedPatch (tree_view);
- pThis->m_information_widget->setPackage (sel, sel->theObj());
+ scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_size_request (scroll, -1, 80);
+ gtk_container_add (GTK_CONTAINER (scroll), m_repos);
+
+ m_repos_expander = gtk_expander_new (_("Repositories"));
+ gtk_container_add (GTK_CONTAINER (m_repos_expander), scroll);
+ return m_repos_expander;
}
- static void wizard_action_cb (YGtkWizard *wizard, gpointer id,
- gint id_type, YGPatchSelector *pThis)
+ static void categories_selection_cb (GtkTreeSelection *selection, Filters *pThis)
{
- const gchar *action = (gchar *) id;
- if (!strcmp (action, "install")) {
- y2milestone ("Closing PackageSelector with 'accept'");
- if (solveProblems())
- YGUI::ui()->sendEvent (new YMenuEvent (YCPSymbol ("accept")));
- }
- else if (!strcmp (action, "cancel")) {
- y2milestone ("Closing PackageSelector with 'cancel'");
- YGUI::ui()->sendEvent (new YCancelEvent());
- }
+fprintf (stderr, "CATEGORIES SELECTED\n");
+ pThis->signalChanged();
}
- static void patch_toggled_cb (GtkCellRendererToggle *renderer,
- gchar *path_str, YGPatchSelector *pThis)
+ void toggle_repo (GtkTreePath *path)
{
IMPL
- GtkTreeModel *model = pThis->m_patches_model;
-
- // Toggle the box
- GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
- gint *column = (gint*) g_object_get_data (G_OBJECT (renderer), "column");
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (m_repos));
+ GtkListStore *store = GTK_LIST_STORE (model);
GtkTreeIter iter;
gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_path_free (path);
- gboolean state;
- ZyppSelectablePtr selectable = 0;
- gtk_tree_model_get (model, &iter, 0, &state, 3, &selectable, -1);
-
- state = !state;
- if (mark_selectable (selectable, state))
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, column, state, -1);
+ gboolean enabled;
+ gtk_tree_model_get (model, &iter, 0, &enabled, -1);
+ gtk_list_store_set (store, &iter, 0, !enabled, -1);
+ if (enabled) repoToggled--; else repoToggled++;
+fprintf (stderr, "repoToggled count: %d\n", repoToggled);
+ signalChanged();
}
- YGWIDGET_IMPL_COMMON
-};
-
-// Package selector's widget
-class PackageSelector : public SourcesTableListener
-{
-
-enum package_columns
-{
- COL_SELECTABLE = 0, // selectable object (pointer)
- COL_INSTALLED_NAME, // installed name (string)
- COL_AVAILABLE_NAME, // available_name (string)
- COL_IS_INSTALLED, // is installed (boolean)
- COL_IS_AVAILABLE, // is available (boolean)
- COL_CAN_BE_UPGRADED, // can be upgraded (boolean)
- COL_CAN_BE_DOWNGRADED, // can be downgraded (boolean)
- COL_SHOW_UPGRADABLE_CONTROL, // show up/downgrade control (boolean)
- COL_HAS_CHILDREN, // has children
- COL_FONT_STYLE // font style; italic for modified (integer) = 10
-};
-
-friend class YGPackageSelector;
-
- GtkWidget *m_widget;
-
- // The GtkTreeView widgets
- GtkWidget *m_installed_view, *m_available_view;
- // Packages backend model
- GtkTreeModel *m_packages_model;
-
- // Package information widget
- PackageInformation *m_information_widget;
- SourcesTable *m_sources_table;
- DiskTable *m_disk_table;
-
- // Search gizmos
- GtkWidget *m_search_entry, *m_plain_view;
- guint search_timeout_id;
- bool name_opt, summary_opt, descr_opt, provides_opt, requires_opt;
- list <string> m_search_queries;
-
- // Interface tweak
- GtkWidget *m_install_label, *m_remove_label;
-
-public:
- PackageSelector (bool patterns_mode)
+ static void repo_toggled_cb (GtkCellRendererToggle *renderer,
+ gchar *path_str, Filters *pThis)
{
IMPL
- m_widget = gtk_vbox_new (FALSE, 0);
-
- GtkWidget *packages_hbox = gtk_hbox_new (FALSE, 0);
-
- GtkWidget *available_box, *installed_box;
- /* All views share a similar model structure. There is a common model for
- all packages, where filters are installed upon to split it on two, each
- installed on the tree view. The common model follows the following spec:
- 0 - selectable object (pointer), 1 - installed name (string), 2 - available
- name (string), 3 - is installed (boolean), 4 - is available (boolean),
- 5 - can be upgraded (boolean), 6 - can be downgraded (boolean),
- 7 - show up/downgrade control (boolean), 8 - has children,
- 9 - font style; italic for modified (integer) = 10
-
- Models are created at each view mode change (and the other freed). This
- allows for more than one model type be used and is also better for speed,
- since the filter and tree view then installed upon don't have to keep
- syncing at every item change. */
- installed_box = createListWidget (_("<b>Installed Software:</b>"),
- "computer", computer_xpm, m_installed_view,
- 1, false);
- available_box = createListWidget (_("<b>Available Software:</b>"),
- "gtk-cdrom", NULL, m_available_view,
- 2, true);
-
- /* FIXME: it seems (due to markup or something) search, this won't work.
- Not really a issue as we provide searching, but...
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_installed_view), 0);
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_available_view), 0); */
- gtk_tree_view_set_enable_search (GTK_TREE_VIEW (m_installed_view), FALSE);
- gtk_tree_view_set_enable_search (GTK_TREE_VIEW (m_available_view), FALSE);
-
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
- GTK_TREE_VIEW (m_installed_view)), GTK_SELECTION_MULTIPLE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
- GTK_TREE_VIEW (m_available_view)), GTK_SELECTION_MULTIPLE);
-
- GtkWidget *buttons_minsize, *selection_buttons_vbox, *install_button,
- *remove_button;
- selection_buttons_vbox = gtk_vbox_new (TRUE, 80);
- // to avoid re-labeling glitches, let it only grow
- buttons_minsize = ygtk_adj_size_new();
- gtk_container_add (GTK_CONTAINER (buttons_minsize), selection_buttons_vbox);
- ygtk_adj_size_set_only_expand (YGTK_ADJ_SIZE (buttons_minsize), TRUE);
-
- install_button = createArrowButton (_("_install"), GTK_ARROW_RIGHT, &m_install_label);
- remove_button = createArrowButton (_("_remove"), GTK_ARROW_LEFT, &m_remove_label);
-
- GtkWidget *install_align = gtk_alignment_new (0, 1, 1, 0);
- gtk_container_add (GTK_CONTAINER (install_align), install_button);
- GtkWidget *remove_align = gtk_alignment_new (0, 0, 1, 0);
- gtk_container_add (GTK_CONTAINER (remove_align), remove_button);
-
- gtk_box_pack_start (GTK_BOX (selection_buttons_vbox), install_align,
- TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (selection_buttons_vbox), remove_align,
- TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (selection_buttons_vbox), 6);
-
- gtk_box_pack_start (GTK_BOX (packages_hbox), available_box, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (packages_hbox), buttons_minsize,
- FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (packages_hbox), installed_box, TRUE, TRUE, 0);
-
- GtkWidget *view_box, *view_label, *view_categories, *view_patterns,
- *view_languages;
- view_label = gtk_label_new (_("View Packages:"));
- gtk_label_set_use_markup (GTK_LABEL (view_label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (view_label), 0, 0.5);
- m_plain_view = gtk_radio_button_new_with_mnemonic (NULL, _("as _plain list"));
- view_categories = gtk_radio_button_new_with_mnemonic_from_widget
- (GTK_RADIO_BUTTON (m_plain_view), _("in _categories"));
- view_patterns = gtk_radio_button_new_with_mnemonic_from_widget
- (GTK_RADIO_BUTTON (m_plain_view), _("in _patterns"));
- view_languages = gtk_radio_button_new_with_mnemonic_from_widget
- (GTK_RADIO_BUTTON (m_plain_view), _("in _languages"));
- view_box = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (view_box), view_label, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (view_box), m_plain_view, FALSE, TRUE, 4);
- gtk_box_pack_start (GTK_BOX (view_box), view_categories, FALSE, TRUE, 4);
- gtk_box_pack_start (GTK_BOX (view_box), view_patterns, FALSE, TRUE, 4);
- gtk_box_pack_start (GTK_BOX (view_box), view_languages, FALSE, TRUE, 4);
- g_signal_connect (G_OBJECT (m_plain_view), "toggled",
- G_CALLBACK (view_plain_mode_cb), this);
- g_signal_connect (G_OBJECT (view_categories), "toggled",
- G_CALLBACK (view_categories_mode_cb), this);
- g_signal_connect (G_OBJECT (view_patterns), "toggled",
- G_CALLBACK (view_patterns_mode_cb), this);
- g_signal_connect (G_OBJECT (view_languages), "toggled",
- G_CALLBACK (view_languages_mode_cb), this);
-
- // default search fields
- name_opt = summary_opt = provides_opt = true;
- requires_opt = descr_opt = false;
-
- GtkWidget *search_hbox, *search_label;
- search_hbox = gtk_hbox_new (FALSE, 0);
- search_label = gtk_label_new_with_mnemonic (_("_Search:"));
- gtk_label_set_use_markup (GTK_LABEL (search_label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (search_label), 0, 0.5);
- m_search_entry = ygtk_find_entry_new();
- gtk_label_set_mnemonic_widget (GTK_LABEL (search_label), m_search_entry);
- gtk_box_pack_start (GTK_BOX (search_hbox), search_label, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (search_hbox), m_search_entry, TRUE, TRUE, 4);
- search_timeout_id = 0;
- g_signal_connect (G_OBJECT (m_search_entry), "activate", // when Enter
- G_CALLBACK (search_activate_cb), this); // is pressed
- g_signal_connect_after (G_OBJECT (m_search_entry), "changed",
- G_CALLBACK (search_request_cb), this);
- ygtk_find_entry_attach_menu (YGTK_FIND_ENTRY (m_search_entry),
- create_search_menu());
-
- /* we want "View Packages" to be aligned to "Search"; we could use a
- GtkTable for that, but a GtkSizeGroup does the job with less hassle. */
- GtkSizeGroup *align_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- gtk_size_group_add_widget (align_labels, view_label);
- gtk_size_group_add_widget (align_labels, search_label);
- g_object_unref (G_OBJECT (align_labels));
-
- m_information_widget = new PackageInformation (_("Package Information"), false);
- GtkWidget *pkg_info_widget = m_information_widget->getWidget();
-
- m_sources_table = new SourcesTable (this);
- m_disk_table = new DiskTable();
-
- GtkWidget *advanced_expander = gtk_expander_new (_("Advanced"));
- GtkWidget *advanced_notebook = gtk_notebook_new();
- GtkWidget *sources_vbox = gtk_vbox_new (FALSE, 4);
- GtkWidget *sources_label = gtk_label_new (
- _("<i>Use the Software Repositories tool to manage the sources.</i>"));
- gtk_misc_set_alignment (GTK_MISC (sources_label), 1, 0);
- gtk_label_set_use_markup (GTK_LABEL (sources_label), TRUE);
- gtk_box_pack_start (GTK_BOX (sources_vbox), m_sources_table->getWidget(),
- TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (sources_vbox), sources_label, TRUE, TRUE, 0);
- gtk_notebook_set_tab_pos (GTK_NOTEBOOK (advanced_notebook), GTK_POS_BOTTOM);
- gtk_notebook_append_page (GTK_NOTEBOOK (advanced_notebook),
- sources_vbox, gtk_label_new (_("Repositories")));
- gtk_notebook_append_page (GTK_NOTEBOOK (advanced_notebook),
- m_disk_table->getWidget(), gtk_label_new (_("Disk Usage")));
- gtk_container_add (GTK_CONTAINER (advanced_expander), advanced_notebook);
-
- gtk_box_pack_start (GTK_BOX (m_widget), packages_hbox, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (m_widget), view_box, FALSE, FALSE, 12);
- gtk_box_pack_start (GTK_BOX (m_widget), search_hbox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (m_widget), pkg_info_widget, FALSE, FALSE, 12);
- gtk_box_pack_start (GTK_BOX (m_widget), advanced_expander, FALSE, FALSE, 0);
- gtk_widget_show_all (m_widget);
-
- g_object_ref (G_OBJECT (m_widget));
- gtk_object_sink (GTK_OBJECT (m_widget));
-
- // interface sugar
- g_signal_connect (G_OBJECT (install_button), "clicked",
- G_CALLBACK (install_button_clicked_cb), this);
- g_signal_connect (G_OBJECT (remove_button), "clicked",
- G_CALLBACK (remove_button_clicked_cb), this);
-
- g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (
- m_installed_view))), "changed",
- G_CALLBACK (package_clicked_cb), this);
- g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (
- m_available_view))), "changed",
- G_CALLBACK (package_clicked_cb), this);
-
- // signal for default view
- if (patterns_mode)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view_patterns), TRUE);
- else
- g_signal_emit_by_name (G_OBJECT (m_plain_view), "toggled", this);
+ GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+ pThis->toggle_repo (path);
+ gtk_tree_path_free (path);
}
- // create widgets functions to cut down on code
- GtkWidget *createListWidget (const char *header, const char *stock_icon,
- const char **xpm_icon, GtkWidget *&list, int package_name_col,
- bool has_version_col)
+ static void repo_clicked_cb (GtkTreeView *view, GtkTreePath *path,
+ GtkTreeViewColumn *column, Filters *pThis)
{
- GtkWidget *vbox, *header_hbox, *image, *label, *scrolled_window;
-
- vbox = gtk_vbox_new (FALSE, 0);
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type
- (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
- list = gtk_tree_view_new();
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (list), FALSE);
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (list), TRUE);
- gtk_tree_selection_set_select_function (gtk_tree_view_get_selection (
- GTK_TREE_VIEW (list)), dont_select_groups_cb, this, NULL);
- gtk_container_add (GTK_CONTAINER (scrolled_window), list);
-
- header_hbox = gtk_hbox_new (FALSE, 0);
- image = NULL;
- if (stock_icon)
- image = gtk_image_new_from_icon_name (stock_icon, GTK_ICON_SIZE_BUTTON);
- if ((!stock_icon || gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_EMPTY)
- && xpm_icon) {
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (xpm_icon);
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
- }
- label = gtk_label_new_with_mnemonic (header);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), list);
- if (image)
- gtk_box_pack_start (GTK_BOX (header_hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (header_hbox), label, FALSE, FALSE, 4);
-
- gtk_box_pack_start (GTK_BOX (vbox), header_hbox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 4);
-
- // The treeview model will be built according to the view... Columns
- // and renderers are common anyway...
- GtkCellRenderer *text_renderer = gtk_cell_renderer_text_new();
- g_object_set (G_OBJECT (text_renderer),
- "ellipsize", PANGO_ELLIPSIZE_END, NULL);
- GtkTreeViewColumn *column;
- column = gtk_tree_view_column_new_with_attributes (_("Packages"),
- text_renderer, "markup", package_name_col, "style", 9, NULL);
- gtk_tree_view_column_set_expand (column, TRUE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
- // versions combo column
- if (has_version_col) {
- GtkCellRenderer *arrow_renderer = ygtk_cell_renderer_arrow_new();
- column = gtk_tree_view_column_new_with_attributes (NULL,
- arrow_renderer, "can-go-up", 5, "can-go-down", 6, "visible", 7, NULL);
- gtk_tree_view_column_set_expand (column, FALSE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
- g_signal_connect (G_OBJECT (arrow_renderer), "pressed",
- G_CALLBACK (change_available_version_cb), this);
- }
- return vbox;
- }
-
- GtkWidget *createArrowButton (const char *label, GtkArrowType arrow_type,
- GtkWidget **label_widget)
- {
- GtkWidget *button, *box = gtk_hbox_new (FALSE, 0);
- GtkWidget *arrow = gtk_arrow_new (arrow_type, GTK_SHADOW_OUT);
- gtk_container_add (GTK_CONTAINER (box), arrow);
- *label_widget = gtk_label_new_with_mnemonic (label);
- gtk_container_add (GTK_CONTAINER (box), *label_widget);
- gtk_box_set_child_packing (GTK_BOX (box), arrow, FALSE, TRUE, 0,
- arrow_type == GTK_ARROW_LEFT ? GTK_PACK_START : GTK_PACK_END);
-
- button = gtk_button_new();
- gtk_container_add (GTK_CONTAINER (button), box);
- return button;
+ IMPL
+ pThis->toggle_repo (path);
}
- // Dynamic views support
- void load_packages_view (GtkTreeModel *(* build_model) (GtkProgressBar *))
- {
- GtkWidget *dialog, *label, *vbox, *progress = 0;
- dialog = gtk_dialog_new();
- gtk_window_set_title (GTK_WINDOW (dialog), "");
- gtk_window_set_transient_for (GTK_WINDOW (dialog),
- YGUI::ui()->currentWindow());
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_default_size (GTK_WINDOW (dialog), 100, -1);
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
- vbox = GTK_DIALOG (dialog)->vbox;
-// gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
- label = gtk_label_new (_("Loading packages list..."));
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 4);
- progress = gtk_progress_bar_new();
- gtk_box_pack_start (GTK_BOX (vbox), progress, TRUE, FALSE, 4);
- gtk_widget_show_all (dialog);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (m_installed_view), NULL);
- gtk_tree_view_set_model (GTK_TREE_VIEW (m_available_view), NULL);
- m_information_widget->setPackage (NULL, NULL);
-
- GtkProgressBar *progress_bar = GTK_PROGRESS_BAR (progress);
- // build it
- GtkTreeModel *model = (m_packages_model = build_model (progress_bar));
-
- GtkTreeModel *installed_model, *available_model;
- installed_model = gtk_tree_model_filter_new (model, NULL);
- available_model = gtk_tree_model_filter_new (model, NULL);
- g_object_unref (G_OBJECT (model));
-
- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (
- installed_model), is_package_installed, this, NULL);
- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (
- available_model), is_package_available, this, NULL);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (m_installed_view), installed_model);
- gtk_tree_view_set_model (GTK_TREE_VIEW (m_available_view), available_model);
- g_object_unref (G_OBJECT (installed_model));
- g_object_unref (G_OBJECT (available_model));
-
- // use the "available" name to do the sorting
- GtkTreeSortable *sortable = GTK_TREE_SORTABLE (model);
- gtk_tree_sortable_set_sort_func (sortable, COL_AVAILABLE_NAME,
- YGUtils::sort_compare_cb,
- GINT_TO_POINTER (COL_AVAILABLE_NAME),
- NULL);
- gtk_tree_sortable_set_sort_column_id (sortable, COL_AVAILABLE_NAME,
- GTK_SORT_ASCENDING);
-
- gtk_widget_destroy (dialog);
+ // utility
+ static GtkWidget *labelWidget (const char *label_str, GtkWidget *widget,
+ GtkSizeGroup *group)
+ {
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
+ GtkWidget *label = gtk_label_new_with_mnemonic (label_str);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
+ gtk_size_group_add_widget (group, label);
+ return hbox;
}
+};
- // macros to handle progress bar
- #define SET_PROGRESS(_steps, _jump) int steps = _steps, step = 0, jump = _jump;
- #define PROGRESS() \
- if (progress && ((step++) % jump == 0)) { \
- gdouble fraction = steps > 0 ? ((gdouble) step) / steps : 0; \
- gtk_progress_bar_set_fraction (progress, fraction); \
- while (gtk_events_pending()) gtk_main_iteration(); }
-
- static GtkTreeModel *loadPackagesListAsPlain (GtkProgressBar *progress)
- {
- GtkListStore *store = gtk_list_store_new (10, G_TYPE_POINTER, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT);
- GtkTreeModel *model = GTK_TREE_MODEL (store);
- g_object_set_data (G_OBJECT (model), "detail-package", GINT_TO_POINTER (1));
-
- SET_PROGRESS (zyppPool().size <zypp::Package>(), 200)
- GtkTreeIter iter;
- for (ZyppPool::const_iterator it = zyppPool().byKindBegin <zypp::Package>();
- it != zyppPool().byKindEnd <zypp::Package>(); it++)
- {
- ZyppSelectable selectable = *it;
- gtk_list_store_append (store, &iter);
- loadPackageRow (model, &iter, selectable);
- PROGRESS()
- }
- return model;
- }
+#include "icons/pkg-locked.xpm"
+#include "icons/pkg-unlocked.xpm"
- static GtkTreeModel *loadPackagesListByCategory (GtkProgressBar *progress)
- {
- GtkTreeStore *store = gtk_tree_store_new (10, G_TYPE_POINTER, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT);
- GtkTreeModel *model = GTK_TREE_MODEL (store);
- g_object_set_data (G_OBJECT (model), "detail-package", GINT_TO_POINTER (1));
+class PackageControl
+{
+GtkWidget *m_vbox, *m_status, *m_lock_button, *m_locked_image, *m_unlocked_image,
+ *m_installed_box, *m_available_box, *m_remove_button, *m_install_button,
+ *m_undo_button, *m_versions_combo, *m_version_repo;
+GtkTreeModel *m_versions_model;
- // we need to create the categories tree as we iterate packages
- map <string, GtkTreePath *> tree;
+public:
+std::list <Ypp::Package *> m_packages;
- SET_PROGRESS (zyppPool().size <zypp::Package>(), 80)
- GtkTreeIter iter, parent_iter;
- for (ZyppPool::const_iterator it = zyppPool().byKindBegin <zypp::Package>();
- it != zyppPool().byKindEnd <zypp::Package>(); it++)
- {
- ZyppSelectable selectable = *it;
- ZyppObject object = selectable->theObj();
+ GtkWidget *getWidget()
+ { return m_vbox; }
- GtkTreePath *path = NULL;
- ZyppPackage package = tryCastToZyppPkg (object);
- if (package) {
- // group is a string like "Productivity/Networking/Email/Utilities"
- string group = package->group();
-
- // We will now retrieve the hierarchy of the package's group and
- // make sure a path has already been created on all nodes, as well
- // as get last node's GtkTreePath
- list <string> hierarchy = YGUtils::splitString (group, '/');
- while (!hierarchy.empty()) {
- string node = hierarchy.front();
- hierarchy.pop_front();
-
- map <string, GtkTreePath*>::iterator it = tree.find (node);
- if (it == tree.end()) {
- if (path) {
- gtk_tree_model_get_iter (GTK_TREE_MODEL (store),
- &parent_iter, path);
- gtk_tree_store_append (store, &iter, &parent_iter);
- }
- else // create at root
- gtk_tree_store_append (store, &iter, NULL);
+ PackageControl()
+ {
+ GtkSizeGroup *size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ m_vbox = gtk_vbox_new (FALSE, 6);
+ GtkWidget *hbox, *label;
+
+ m_lock_button = gtk_toggle_button_new();
+ g_signal_connect (G_OBJECT (m_lock_button), "toggled",
+ G_CALLBACK (locked_toggled_cb), this);
+ m_undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
+ g_signal_connect (G_OBJECT (m_undo_button), "clicked",
+ G_CALLBACK (undo_clicked_cb), this);
+
+ hbox = gtk_hbox_new (FALSE, 6);
+ label = gtk_label_new (_("Status:"));
+ YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_size_group_add_widget (size_group, label);
+ m_status = gtk_label_new ("-");
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), m_status, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), m_undo_button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new(0), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), m_lock_button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_vbox), hbox, TRUE, TRUE, 0);
+
+ m_locked_image = createImageFromXPM (pkg_locked_xpm);
+ m_unlocked_image = createImageFromXPM (pkg_unlocked_xpm);
+ g_object_ref_sink (G_OBJECT (m_locked_image));
+ g_object_ref_sink (G_OBJECT (m_unlocked_image));
+
+ m_remove_button = createButton (_("_Remove"), GTK_STOCK_DELETE);
+ g_signal_connect (G_OBJECT (m_remove_button), "clicked",
+ G_CALLBACK (remove_clicked_cb), this);
+ m_install_button = createButton ("", GTK_STOCK_SAVE);
+ g_signal_connect (G_OBJECT (m_install_button), "clicked",
+ G_CALLBACK (install_clicked_cb), this);
+
+ m_installed_box = gtk_hbox_new (FALSE, 6);
+ label = gtk_label_new (_("Installed: "));
+ YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_size_group_add_widget (size_group, label);
+ gtk_box_pack_start (GTK_BOX (m_installed_box), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_installed_box), m_remove_button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_vbox), m_installed_box, TRUE, TRUE, 0);
+
+ m_versions_model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
+ m_versions_combo = gtk_combo_box_new_with_model (m_versions_model);
+ g_signal_connect (G_OBJECT (m_versions_combo), "changed",
+ G_CALLBACK (version_changed_cb), this);
+
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (m_versions_combo), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (m_versions_combo),
+ renderer, "text", 0, NULL);
+
+ m_available_box = gtk_hbox_new (FALSE, 6);
+ label = gtk_label_new (_("Available: "));
+ YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_size_group_add_widget (size_group, label);
+ gtk_box_pack_start (GTK_BOX (m_available_box), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_available_box), m_versions_combo, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_available_box), m_install_button, FALSE, TRUE, 0);
+ label = gtk_label_new (_("(Repository:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ m_version_repo = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (m_version_repo), 0, 0.5);
+ gtk_label_set_ellipsize (GTK_LABEL (m_version_repo), PANGO_ELLIPSIZE_END);
+ gtk_box_pack_start (GTK_BOX (m_available_box), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_available_box), m_version_repo, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_vbox), m_available_box, TRUE, TRUE, 0);
+
+ g_object_unref (G_OBJECT (size_group));
+ }
+
+ ~PackageControl()
+ {
+ gtk_widget_destroy (m_locked_image);
+ g_object_unref (G_OBJECT (m_locked_image));
+ gtk_widget_destroy (m_unlocked_image);
+ g_object_unref (G_OBJECT (m_unlocked_image));
+ }
+
+ void setPackages (const std::list <Ypp::Package *> &packages)
+ {
+fprintf (stderr, "packages selected (%d)\n", packages.size());
+ // FIXME: we'll probably want to re-work the controls interface
+ // for now, let's just handle none-one-multiple selections separatadely
+ m_packages = packages;
+ if (packages.size() == 1) {
+ Ypp::Package *package = packages.front();
+ // status label
+ std::string status;
+ if (package->isInstalled())
+ status = _("Installed ") + package->getInstalledVersion()->number;
+ else
+ status = _("Not installed");
+ if (package->toInstall()) {
+ int nb;
+ const Ypp::Package::Version *version;
+ package->toInstall (&nb);
+ version = package->getAvailableVersion (nb);
+ status += _(" (to install");
+ if (version)
+ status += " " + version->number;
+ status += ")";
+ }
+ else if (package->toRemove())
+ status += _(" (to remove)");
+ gtk_label_set_text (GTK_LABEL (m_status), status.c_str());
+ if (package->isModified())
+ gtk_widget_show (m_undo_button);
+ else
+ gtk_widget_hide (m_undo_button);
- string name = "<big><b>" + node + "</b></big>";
- gtk_tree_store_set (store, &iter,
- 0, NULL, 1, name.c_str(), 2, name.c_str(), 3, TRUE,
- 4, TRUE, 5, FALSE, 6, FALSE, 7, FALSE, 8, TRUE, -1);
+ // install version
+ if (package->isInstalled())
+ gtk_widget_show (m_installed_box);
+ else
+ gtk_widget_hide (m_installed_box);
- path = gtk_tree_model_get_path (model, &iter);
- tree [node] = path;
- }
- else // exists
- path = it->second;
+ // available versions
+ gtk_widget_show (m_versions_combo);
+ if (package->getAvailableVersion (0)) {
+ gtk_list_store_clear (GTK_LIST_STORE (m_versions_model));
+ for (int i = 0; package->getAvailableVersion (i); i++) {
+ const char *version = package->getAvailableVersion (i)->number.c_str();
+fprintf (stderr, "adding version: %s\n", version);
+ GtkTreeIter iter;
+ gtk_list_store_append (GTK_LIST_STORE (m_versions_model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (m_versions_model), &iter,
+ 0, version, 1, i, -1);
}
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_versions_combo), 0);
+ gtk_widget_show (m_available_box);
}
+ else
+ gtk_widget_hide (m_available_box);
- if (!path) // package has no group
- continue;
-
- gtk_tree_model_get_iter (model, &parent_iter, path);
- gtk_tree_store_append (store, &iter, &parent_iter);
- loadPackageRow (model, &iter, selectable);
- PROGRESS()
- }
-
- // free GtkTreePaths
- for (map <string, GtkTreePath*>::iterator it = tree.begin();
- it != tree.end(); it++)
- gtk_tree_path_free (it->second);
- return model;
- }
-
- /* NOTE: Getting the packages under a pattern, language, etc is done
- differently, so code re-use would be limited. Probably doesn't worth
- the trouble and complexity of doing so. */
-
- static GtkTreeModel *loadPackagesListByPattern (GtkProgressBar *progress)
- {
- GtkTreeStore *store = gtk_tree_store_new (10, G_TYPE_POINTER, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT);
- GtkTreeModel *model = GTK_TREE_MODEL (store);
- g_object_set_data (G_OBJECT (model), "detail-package", GINT_TO_POINTER (0));
-
- // we need to create a categories tree for the patterns
- map <string, GtkTreeIter> tree;
-
- SET_PROGRESS (zyppPool().size <zypp::Pattern>(), 5)
- for (ZyppPool::const_iterator it = zyppPool().byKindBegin <zypp::Pattern>();
- it != zyppPool().byKindEnd <zypp::Pattern>(); it++) {
- ZyppSelectable selectable = *it;
- ZyppObject object = selectable->theObj();
- ZyppPattern pattern = tryCastToZyppPattern (object);
- if (pattern && pattern->userVisible()) {
- GtkTreeIter category_iter, pattern_iter, package_iter;
- string category = pattern->category();
- map <string, GtkTreeIter>::iterator cat_it = tree.find (category);
- if (cat_it == tree.end()) {
- string name = "<big><b>" + category + "</b></big>";
- gtk_tree_store_append (store, &category_iter, NULL);
- gtk_tree_store_set (store, &category_iter,
- 0, NULL, 1, name.c_str(), 2, name.c_str(), 3, TRUE,
- 4, TRUE, 5, FALSE, 6, FALSE, 7, FALSE, 8, TRUE, -1);
- tree [category] = category_iter;
- }
+ // is locked
+ gtk_widget_show (m_lock_button);
+ bool locked = package->isLocked();
+ g_signal_handlers_block_by_func (m_lock_button, (gpointer) locked_toggled_cb, this);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_lock_button), locked);
+ g_signal_handlers_unblock_by_func (m_lock_button, (gpointer) locked_toggled_cb, this);
+ gtk_button_set_image (GTK_BUTTON (m_lock_button),
+ locked ? m_locked_image : m_unlocked_image);
+ gtk_widget_set_sensitive (m_install_button, !locked);
+ gtk_widget_set_sensitive (m_remove_button, !locked);
+
+ gtk_widget_show (m_vbox);
+ }
+ else if (packages.size()) {
+ bool allInstalled = true, allNotInstalled = true, allUpgradable = true,
+ allModified = true, allLocked = true, allUnlocked = true;
+ for (std::list <Ypp::Package *>::const_iterator it = packages.begin();
+ it != packages.end(); it++) {
+ if (!(*it)->isInstalled()) {
+ allInstalled = false;
+ allUpgradable = false;
+ }
+ else {
+ allNotInstalled = false;
+ const Ypp::Package::Version *version = (*it)->getAvailableVersion(0);
+ if (!version || version->cmp <= 0)
+ allUpgradable = false;
+ }
+ if (!(*it)->isModified())
+ allModified = false;
+ if ((*it)->isLocked())
+ allUnlocked = false;
else
- category_iter = cat_it->second;
-
- string name = "<b>" + fastGetSummary (object) + "</b>";
- gtk_tree_store_append (store, &pattern_iter, &category_iter);
- loadPackageRow (model, &pattern_iter, selectable);
-
-/* gtk_tree_store_set (store, &pattern_iter,
- 0, get_pointer (selectable), 1, name.c_str(), 2, name.c_str(),
- 3, TRUE, 4, TRUE, 5, FALSE, 6, FALSE, 7, FALSE, 8, TRUE, -1);*/
-
- // adding children packages
- const set <string> &packages = pattern->install_packages();
- for (ZyppPool::const_iterator pt2 =
- zyppPool().byKindBegin <zypp::Package>();
- pt2 != zyppPool().byKindEnd <zypp::Package>(); pt2++) {
- ZyppSelectable sel = *pt2;
- for (set <string>::iterator pt1 = packages.begin();
- pt1 != packages.end(); pt1++) {
- if (sel->name() == *pt1) {
- gtk_tree_store_append (store, &package_iter, &pattern_iter);
- loadPackageRow (model, &package_iter, sel);
- }
- }
- }
+ allLocked = false;
}
- PROGRESS()
- }
- return model;
- }
- static GtkTreeModel *loadPackagesListByLanguage (GtkProgressBar *progress)
- {
- GtkTreeStore *store = gtk_tree_store_new (10, G_TYPE_POINTER, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_INT);
- GtkTreeModel *model = GTK_TREE_MODEL (store);
- g_object_set_data (G_OBJECT (model), "detail-package", GINT_TO_POINTER (0));
-
- SET_PROGRESS (zyppPool().size <zypp::Language>(), 20)
- for (ZyppPool::const_iterator it = zyppPool().byKindBegin <zypp::Language>();
- it != zyppPool().byKindEnd <zypp::Language>(); it++) {
- ZyppSelectable langsel = *it;
- ZyppObject langobj = langsel->theObj();
- ZyppLanguage lang = tryCastToZyppLanguage (langobj);
- if (lang) {
- string langname = langsel->name();
- if (langname.empty() || langname == "C")
- continue;
-
- string descrpt = "<b>" + langobj->description() + "</b>";
- GtkTreeIter parent_iter, iter;
- gtk_tree_store_append (store, &parent_iter, NULL);
- loadPackageRow (model, &parent_iter, langsel);
-/* gtk_tree_store_set (store, &parent_iter,
- 0, get_pointer (langsel), 1, descrpt.c_str(), 2, descrpt.c_str(),
- 3, TRUE, 4, TRUE, 5, FALSE, 6, FALSE, 7, FALSE, 8, TRUE, -1);*/
-
- for (ZyppPool::const_iterator it =
- zyppPool().byKindBegin <zypp::Package>();
- it != zyppPool().byKindEnd <zypp::Package>(); it++) {
- ZyppSelectable pkgsel = *it;
- ZyppObject pkgobj = pkgsel->theObj();
-
- const zypp::CapSet &capSet = pkgobj->dep (zypp::Dep::FRESHENS);
- for (zypp::CapSet::const_iterator it = capSet.begin();
- it != capSet.end(); it++) {
- if (it->index() == lang->name()) {
- gtk_tree_store_append (store, &iter, &parent_iter);
- loadPackageRow (model, &iter, pkgsel);
- }
- }
- }
- }
- PROGRESS()
- }
- return model;
- }
- #undef SET_PROGRESS
- #undef PROGRESS
-
- static void induceObjects (ZyppSelectable selectable, ZyppObject &install_obj,
- ZyppObject &available_obj, bool *has_upgrade,
- bool *has_downgrade)
- {
- available_obj = (install_obj = NULL);
- if (!selectable)
- return;
- switch (selectable->status()) {
- case zypp::ui::S_Install:
- case zypp::ui::S_Update:
- install_obj = selectable->candidateObj();
- break;
- case zypp::ui::S_Del:
- available_obj = selectable->installedObj();
- break;
- default:
- available_obj = selectable->candidateObj();
- install_obj = selectable->installedObj();
- break;
- }
+ std::string status;
+ if (allInstalled)
+ status = _("Installed");
+ else if (allNotInstalled)
+ status = _("Not installed");
+ else
+ status = _("--");
- // zypp keeps on the pool objects whose sources we disabled, so we may
- // need to calculate the candidate object here.
-#ifdef PRE_ZYPP_3
- if (available_obj != NULL && !available_obj->source().enabled()) {
-#else
- // beware lurking tribool requires bool cast here.
- if (available_obj != NULL && !(bool)(available_obj->repository().info().enabled())) {
-#endif
- available_obj = NULL;
- for (zypp::ui::Selectable::available_iterator it = selectable->availableBegin();
- it != selectable->availableEnd(); it++) {
-#ifdef PRE_ZYPP_3
- if (!(*it)->source().enabled())
-#else
- if (!(*it)->repository().info().enabled())
-#endif
- ;
- else if (!available_obj)
- available_obj = *it;
- else if (zypp::Edition::compare ((*it)->edition(),
- available_obj->edition()) > 0)
- available_obj = *it;
+ if (allModified) {
+ status += _(" (modified)");
+ gtk_widget_show (m_undo_button);
}
- }
-
- bool has_up = false, has_down = false;
- if (available_obj != NULL && install_obj != NULL) {
- int res = zypp::Edition::compare (install_obj->edition(),
- available_obj->edition());
- if (res < 0)
- has_up = true;
- else if (res > 0)
- has_down = true;
- }
-
- if (has_upgrade)
- *has_upgrade = has_up;
- if (has_downgrade)
- *has_downgrade = has_down;
- }
-
- /* Must be called for the main model. */
- static void loadPackageRow (GtkTreeModel *model, GtkTreeIter *iter,
- ZyppSelectable selectable)
- {
- ZyppObject install_obj, available_obj;
- bool has_upgrade, has_downgrade, has_children = FALSE;
- induceObjects (selectable, install_obj, available_obj,
- &has_upgrade, &has_downgrade);
-
- bool detailed = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (model),
- "detail-package"));
- string availableName, installedName, name (YGUtils::escape_markup (selectable->name()));
- if (available_obj) {
- if (detailed)
- availableName = "<b>" + name + "</b> (" + available_obj->edition().version() +
- ")\n<small>" + YGUtils::escape_markup (fastGetSummary (available_obj)) +
- "</small>";
- else {
- ZyppPattern pattern = tryCastToZyppPattern (available_obj);
- ZyppLanguage lang = tryCastToZyppLanguage (available_obj);
- if (pattern) {
- availableName = "<b>" + fastGetSummary (available_obj) + "</b>";
- has_children = TRUE;
- } else if (lang) {
- availableName = "<b>" + available_obj->description() + "</b>";
- has_children = TRUE;
- } else
- availableName = name + " (" + available_obj->edition().version() + ")";
- }
- }
- if (install_obj) {
- if (detailed)
- installedName = "<b>" + name + "</b> (" + install_obj->edition().version() +
- ")\n<small>" + YGUtils::escape_markup (fastGetSummary (install_obj)) +
- "</small>";
- else {
- ZyppPattern pattern = tryCastToZyppPattern (install_obj);
- ZyppLanguage lang = tryCastToZyppLanguage (install_obj);
- if (pattern) {
- installedName = "<b>" + fastGetSummary (install_obj) + "</b>";
- has_children = TRUE;
- } else if (lang) {
- installedName = "<b>" + install_obj->description() + "</b>";
- has_children = TRUE;
- } else
- installedName = name + " (" + install_obj->edition().version() + ")";
- }
- }
-
- // Make sure that both the availableName and installedName
- // are filled. Occasionally, the names are empty, so the
- // following checks make sure these variable are filled.
- if (availableName.empty())
- availableName = installedName;
- else if (installedName.empty())
- installedName = availableName;
-
- PangoStyle style = PANGO_STYLE_NORMAL;
- if (selectable->toModify())
- style = PANGO_STYLE_ITALIC;
-
- // oh, would be nice to have a common set for tree models...
- if (GTK_IS_LIST_STORE (model))
- gtk_list_store_set (GTK_LIST_STORE (model), iter,
- COL_SELECTABLE, get_pointer (selectable),
- COL_INSTALLED_NAME, installedName.c_str(),
- COL_AVAILABLE_NAME, availableName.c_str(),
- COL_IS_INSTALLED, install_obj != 0,
- COL_IS_AVAILABLE, available_obj != 0,
- COL_CAN_BE_UPGRADED, has_upgrade,
- COL_CAN_BE_DOWNGRADED, has_downgrade,
- COL_SHOW_UPGRADABLE_CONTROL, detailed,
- COL_HAS_CHILDREN, has_children,
- COL_FONT_STYLE, style, -1);
- else /*if (GTK_IS_TREE_STORE (model))*/
- gtk_tree_store_set (GTK_TREE_STORE (model), iter,
- COL_SELECTABLE, get_pointer (selectable),
- COL_INSTALLED_NAME, installedName.c_str(),
- COL_AVAILABLE_NAME, availableName.c_str(),
- COL_IS_INSTALLED, install_obj != 0,
- COL_IS_AVAILABLE, available_obj != 0,
- COL_CAN_BE_UPGRADED, has_upgrade,
- COL_CAN_BE_DOWNGRADED, has_downgrade,
- COL_SHOW_UPGRADABLE_CONTROL, detailed,
- COL_HAS_CHILDREN, has_children,
- COL_FONT_STYLE, style, -1);
-/* y2milestone ("set %s: %d - %d\n", selectable->name().c_str(),
- available_obj != 0, install_obj != 0);*/
- }
+ else
+ gtk_widget_hide (m_undo_button);
+ gtk_label_set_text (GTK_LABEL (m_status), status.c_str());
- virtual ~PackageSelector()
- {
- IMPL
- if (search_timeout_id)
- g_source_remove (search_timeout_id);
+ // install version
+ if (allInstalled)
+ gtk_widget_show (m_installed_box);
+ else
+ gtk_widget_hide (m_installed_box);
- delete m_information_widget;
- delete m_sources_table;
- delete m_disk_table;
- gtk_widget_destroy (m_widget);
- g_object_unref (G_OBJECT (m_widget));
- }
+ // available versions
+ gtk_widget_hide (m_versions_combo);
+ if (allNotInstalled || allUpgradable) {
+ gtk_widget_show (m_available_box);
+ const char *installLabel = _("Install");
+ if (allUpgradable)
+ installLabel = _("Upgrade");
+ gtk_button_set_label (GTK_BUTTON (m_install_button), installLabel);
+ }
+ else
+ gtk_widget_hide (m_available_box);
- GtkWidget *getWidget()
- { return m_widget; }
+ // is locked
+ if (allLocked || allUnlocked) {
+ gtk_widget_show (m_lock_button);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_lock_button), allLocked);
+ gtk_button_set_image (GTK_BUTTON (m_lock_button),
+ allLocked ? m_locked_image : m_unlocked_image);
+ gtk_widget_set_sensitive (m_install_button, !allLocked);
+ gtk_widget_set_sensitive (m_remove_button, !allLocked);
+ }
+ else {
+ gtk_widget_hide (m_lock_button);
+ gtk_widget_set_sensitive (m_install_button, TRUE);
+ gtk_widget_set_sensitive (m_remove_button, TRUE);
+ }
+ gtk_widget_show (m_vbox);
+ }
+ else
+ gtk_widget_hide (m_vbox);
- static void view_plain_mode_cb (GtkToggleButton *button,
- PackageSelector *pThis)
- {
- if (!gtk_toggle_button_get_active (button)) return;
- pThis->load_packages_view (&loadPackagesListAsPlain);
+#if 0
+ m_package = package;
+ if (package) {
+ if (package->isInstalled()) {
+ gtk_widget_show (m_remove_button);
+ gtk_widget_hide (m_install_button);
+ }
+ else {
+ gtk_widget_show (m_install_button);
+ gtk_widget_hide (m_remove_button);
+ }
+ if (package && package->hasUpgrade())
+ gtk_widget_show (m_upgrade_button);
+ else
+ gtk_widget_hide (m_upgrade_button);
+ }
+ else {
+ gtk_widget_hide (m_install_button);
+ gtk_widget_hide (m_remove_button);
+ gtk_widget_hide (m_upgrade_button);
+ }
+#endif
}
- static void view_categories_mode_cb (GtkToggleButton *button,
- PackageSelector *pThis)
+private:
+ static void install_clicked_cb (GtkButton *button, PackageControl *pThis)
{
- if (!gtk_toggle_button_get_active (button)) return;
- pThis->clear_search_entry (true);
- pThis->load_packages_view (&loadPackagesListByCategory);
+ busyCursor();
+ Ypp::get()->startTransactions();
+ for (std::list <Ypp::Package *>::iterator it = pThis->m_packages.begin();
+ it != pThis->m_packages.end(); it++) {
+ int version;
+ if (GTK_WIDGET_VISIBLE (pThis->m_versions_combo))
+ version = gtk_combo_box_get_active (GTK_COMBO_BOX (
+ pThis->m_versions_combo));
+ else
+ version = 0; // i.e. most recent (on multi-packages)
+ (*it)->install (version);
+ }
+ Ypp::get()->finishTransactions();
+ normalCursor();
}
- static void view_patterns_mode_cb (GtkToggleButton *button,
- PackageSelector *pThis)
+ static void remove_clicked_cb (GtkButton *button, PackageControl *pThis)
{
- if (!gtk_toggle_button_get_active (button)) return;
- pThis->clear_search_entry (true);
- pThis->load_packages_view (&loadPackagesListByPattern);
+ busyCursor();
+ Ypp::get()->startTransactions();
+ for (std::list <Ypp::Package *>::iterator it = pThis->m_packages.begin();
+ it != pThis->m_packages.end(); it++)
+ (*it)->remove();
+ Ypp::get()->finishTransactions();
+ normalCursor();
}
- static void view_languages_mode_cb (GtkToggleButton *button,
- PackageSelector *pThis)
+ static void undo_clicked_cb (GtkButton *button, PackageControl *pThis)
{
- if (!gtk_toggle_button_get_active (button)) return;
- pThis->clear_search_entry (true);
- pThis->load_packages_view (&loadPackagesListByLanguage);
+ busyCursor();
+ Ypp::get()->startTransactions();
+ for (std::list <Ypp::Package *>::iterator it = pThis->m_packages.begin();
+ it != pThis->m_packages.end(); it++)
+ (*it)->undo();
+ Ypp::get()->finishTransactions();
+ normalCursor();
}
- void sources_changed_cb()
+ static void locked_toggled_cb (GtkToggleButton *button, PackageControl *pThis)
{
- // reload view; FIXME: re-load the current view, not necessarly
- // the plain list; hacky anyway
- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m_plain_view)))
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_plain_view), TRUE);
- else
- g_signal_emit_by_name (G_OBJECT (m_plain_view), "toggled", this);
+ busyCursor();
+ Ypp::get()->startTransactions();
+ for (std::list <Ypp::Package *>::iterator it = pThis->m_packages.begin();
+ it != pThis->m_packages.end(); it++)
+ (*it)->lock (gtk_toggle_button_get_active (button));
+ Ypp::get()->finishTransactions();
+ normalCursor();
}
- void clear_search_entry (bool dont_load)
+ static void version_changed_cb (GtkComboBox *combo, PackageControl *pThis)
{
- if (dont_load)
- g_signal_handlers_block_by_func (m_search_entry,
- (gpointer) search_request_cb, this);
- gtk_entry_set_text (GTK_ENTRY (m_search_entry), "");
- if (dont_load)
- g_signal_handlers_unblock_by_func (m_search_entry,
- (gpointer) search_request_cb, this);
- }
+ fprintf (stderr, "version changed\n");
+ if (!pThis->m_packages.empty()) {
+ Ypp::Package *package = pThis->m_packages.front();
+ int nb;
+ GtkTreeIter iter;
+ if (gtk_combo_box_get_active_iter (combo, &iter)) {
+ gtk_tree_model_get (pThis->m_versions_model, &iter, 1, &nb, -1);
+ const Ypp::Package::Version *version;
+ fprintf (stderr, "get available version %d\n", nb);
+ version = package->getAvailableVersion (nb);
+ g_assert (version != NULL);
+
+ const Ypp::Repository *repo = Ypp::get()->getRepository (version->repo);
+ if (repo) {
+ std::string repo_str = repo->name + ")";
+ gtk_label_set_text (GTK_LABEL (pThis->m_version_repo), repo_str.c_str());
+ }
+ else
+ gtk_label_set_text (GTK_LABEL (pThis->m_version_repo),
+ "TODO: hide this for collections)");
- static void search_activate_cb (GtkEntry *entry, PackageSelector *pThis)
- {
- IMPL
- if (pThis->search_timeout_id)
- g_source_remove (pThis->search_timeout_id);
- search_cb (pThis);
+ const char *installLabel = _("Install");
+ if (package->isInstalled()) {
+ if (version->cmp > 0)
+ installLabel = _("Upgrade");
+ else if (version->cmp == 0)
+ installLabel = _("Re-install");
+ else //if (version->cmp < 0)
+ installLabel = _("Downgrade");
+ }
+ gtk_button_set_label (GTK_BUTTON (pThis->m_install_button), installLabel);
+ }
+ }
}
- static void search_request_cb (GtkEditable *editable, PackageSelector *pThis)
+ // utility
+ static GtkWidget *createButton (const char *label_str, const gchar *stock_id)
{
- IMPL
- // we'll make a delay for the actual search to wait for the user
- // to finish writting
- if (pThis->search_timeout_id)
- g_source_remove (pThis->search_timeout_id);
- pThis->search_timeout_id = g_timeout_add (500, search_cb, pThis);
+ GtkWidget *button, *image;
+ button = gtk_button_new_with_mnemonic (label_str);
+ if (stock_id) {
+ image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ }
+ return button;
}
+};
- struct FindClosure {
- bool found;
- GtkTreeView *view;
- PackageSelector *pThis;
- };
- static gboolean find_exact_match (GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, gpointer data)
- {
- FindClosure *cl = (FindClosure *) data;
-
- ZyppSelectablePtr sel = NULL;
-
- gtk_tree_model_get (model, iter, COL_SELECTABLE, &sel, -1);
-
- if (!sel)
- return FALSE;
-
- if (sel->name() == *cl->pThis->m_search_queries.begin()) {
- cl->found = true;
- gtk_tree_selection_select_iter
- (gtk_tree_view_get_selection (cl->view), iter);
- package_clicked_cb (gtk_tree_view_get_selection (cl->view), cl->pThis);
- return TRUE;
- }
- return FALSE;
- }
-
- void highlight_exact_matches ()
- {
- if (m_search_queries.empty() || !name_opt)
- return;
+class PackageInfo
+{
+GtkWidget *m_widget, *m_description, *m_filelist, *m_changelog, *m_authors;
- FindClosure cl;
- cl.found = false;
- cl.pThis = this;
- cl.view = GTK_TREE_VIEW (m_installed_view);
-
- gtk_tree_model_foreach (gtk_tree_view_get_model (cl.view),
- find_exact_match, &cl);
-
- if (!cl.found) {
- cl.view = GTK_TREE_VIEW (m_available_view);
- gtk_tree_model_foreach (gtk_tree_view_get_model (cl.view),
- find_exact_match, &cl);
- }
- }
+public:
+ GtkWidget *getWidget()
+ { return m_widget; }
- static gboolean search_cb (gpointer data)
+ PackageInfo()
{
- IMPL
-
- // This is potentially very slow ...
-#ifdef IMPL_DEBUG
- fprintf (stderr, "search start...\n");
-#endif
- PackageSelector *pThis = (PackageSelector *) data;
- pThis->search_timeout_id = 0;
-
- const gchar *query = gtk_entry_get_text (GTK_ENTRY (pThis->m_search_entry));
- bool plain_view = gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON (pThis->m_plain_view));
- if (!plain_view)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pThis->m_plain_view), TRUE);
- pThis->m_search_queries = YGUtils::splitString (query, ' ');
-
- // just re-filter
- GtkTreeModel *available_model =
- gtk_tree_view_get_model (GTK_TREE_VIEW (pThis->m_available_view));
- GtkTreeModel *installed_model =
- gtk_tree_view_get_model (GTK_TREE_VIEW (pThis->m_installed_view));
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (available_model));
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (installed_model));
-
- pThis->highlight_exact_matches ();
-
-#ifdef IMPL_DEBUG
- fprintf (stderr, "search done...\n");
-#endif
- return FALSE;
+ m_widget = gtk_notebook_new();
+ addPage (_("Description"), createHtmlWidget (&m_description));
+ addPage (_("File List"), createHtmlWidget (&m_filelist));
+ addPage (_("ChangeLog"), createHtmlWidget (&m_changelog));
+ addPage (_("Authors"), createHtmlWidget (&m_authors));
+ gtk_widget_set_size_request (m_widget, -1, 150);
+ ygtk_html_wrap_connect_link_clicked (m_filelist,
+ G_CALLBACK (path_pressed_cb), NULL);
}
- GtkMenu *create_search_menu()
+ void setPackage (Ypp::Package *package)
{
- GtkWidget *menu = gtk_menu_new();
- append_option_item (menu, _("Name"), &name_opt);
- append_option_item (menu, _("Summary"), &summary_opt);
- append_option_item (menu, _("Description"), &descr_opt);
- append_option_item (menu, _("RPM Provides"), &provides_opt);
- append_option_item (menu, _("RPM Requires"), &requires_opt);
- gtk_widget_show_all (menu);
- return GTK_MENU (menu);
+ if (package) {
+ setText (m_description, package->description());
+ setText (m_filelist, package->filelist());
+ setText (m_changelog, package->changelog());
+ setText (m_authors, package->authors());
+ if (!GTK_WIDGET_VISIBLE (m_widget)) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (m_widget), 0);
+ gtk_widget_show (m_widget);
+ }
+ }
+ else
+ gtk_widget_hide (m_widget);
}
- static void append_option_item (GtkWidget *menu, const char *label, bool *option)
+private:
+ static void path_pressed_cb (GtkWidget *text, const gchar *link)
+ { FILEMANAGER_LAUNCH (link); }
+
+ // utilities:
+ static GtkWidget *createHtmlWidget (GtkWidget **html_widget)
{
- GtkWidget *item = gtk_check_menu_item_new_with_label (label);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), *option);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- g_signal_connect (G_OBJECT (item), "toggled",
- G_CALLBACK (search_option_change_cb), option);
+ *html_widget = ygtk_html_wrap_new();
+ GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (scroll), *html_widget);
+ return scroll;
}
- static void search_option_change_cb (GtkCheckMenuItem *item, bool *option)
- { *option = item->active; }
-
- inline static gboolean is_package_visible (GtkTreeModel *model, GtkTreeIter *iter,
- PackageSelector *pThis, int visible_col)
+ void addPage (const char *title, GtkWidget *content)
{
- gboolean visible, has_children;
- ZyppSelectablePtr selectable;
-
- gtk_tree_model_get (model, iter, visible_col, &visible,
- COL_HAS_CHILDREN, &has_children,
- COL_SELECTABLE, &selectable, -1);
-
-// fprintf (stderr, "is visible '%s'\n", selectable ? selectable->name().c_str() : "<noname>");
- if (has_children)
- visible = TRUE;
- else if (visible && !pThis->m_search_queries.empty())
- visible = pThis->does_package_match (selectable);
-
- return visible;
+ gtk_notebook_append_page (GTK_NOTEBOOK (m_widget), content, gtk_label_new (title));
}
- static gboolean is_package_installed (GtkTreeModel *model, GtkTreeIter *iter,
- gpointer data)
- { return is_package_visible (model, iter, (PackageSelector *) data, 3); }
-
- static gboolean is_package_available (GtkTreeModel *model, GtkTreeIter *iter,
- gpointer data)
+ void setText (GtkWidget *rtext, const std::string &text)
{
- gboolean is_installed, is_available, has_upgrade, has_children;
- gboolean visible = TRUE;
- ZyppSelectablePtr selectable;
- PackageSelector *pThis = (PackageSelector *) data;
-
- // only show the packages that aren't installed
- // unless there's an upgrade available
- gtk_tree_model_get (model, iter, COL_SELECTABLE, &selectable,
- COL_IS_INSTALLED, &is_installed,
- COL_IS_AVAILABLE, &is_available,
- COL_CAN_BE_UPGRADED, &has_upgrade,
- COL_HAS_CHILDREN, &has_children, -1);
- if (!has_children) {
- if (is_available && (!is_installed || has_upgrade)) {
- if (!pThis->m_search_queries.empty())
- visible = pThis->does_package_match (selectable);
- } else
- visible = FALSE;
+ if (text.empty()) {
+ const char *empty = _("<i>(only available for installed packages)</i>");
+ ygtk_html_wrap_set_text (rtext, empty);
}
-
- return visible;
+ else
+ ygtk_html_wrap_set_text (rtext, text.c_str());
+ ygtk_html_wrap_scroll (rtext, TRUE);
}
+};
- bool does_package_match_one (ZyppSelectablePtr sel, string key)
- {
- ZyppObject obj = NULL;
+class DiskView : public Ypp::Disk::Listener
+{
+GtkWidget *m_widget;
+bool m_hasWarn;
+GtkTreeModel *m_model;
- if (name_opt && YGUtils::contains (sel->name(), key))
- return TRUE;
-
- if (summary_opt || descr_opt || provides_opt || requires_opt)
- obj = sel->theObj();
-
- if (summary_opt && YGUtils::contains (fastGetSummary (obj), key))
- return TRUE;
- if (descr_opt && YGUtils::contains (obj->description(), key))
- return TRUE;
- if (provides_opt) {
- const zypp::CapSet &capSet = obj->dep (zypp::Dep::PROVIDES);
- for (zypp::CapSet::const_iterator it = capSet.begin();
- it != capSet.end(); it++)
- if (YGUtils::contains (it->asString(), key))
- return TRUE;
- }
- if (requires_opt) {
- const zypp::CapSet &capSet = obj->dep (zypp::Dep::REQUIRES);
- for (zypp::CapSet::const_iterator it = capSet.begin();
- it != capSet.end(); it++)
- if (YGUtils::contains (it->asString(), key))
- return TRUE;
- }
- return FALSE;
- }
+public:
+ GtkWidget *getWidget()
+ { return m_widget; }
- gboolean does_package_match (ZyppSelectablePtr sel)
+ DiskView()
+ : m_hasWarn (false)
{
- if (m_search_queries.empty())
- return true;
+ m_model = GTK_TREE_MODEL (gtk_list_store_new (
+ // 0 - mount point, 1 - usage percent, 2 - usage string
+ 3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING));
+ m_widget = createCombo (m_model);
+ g_object_unref (G_OBJECT (m_model));
- bool and_results = true; // vs. or them ...
+ Ypp::get()->getDisk()->setListener (this);
+ update();
+ }
- bool result = and_results;
- for (list <string>::iterator it = m_search_queries.begin();
- it != m_search_queries.end(); it++) {
-
- // TODO: googlify more ...
- if (*it == "OR") {
- and_results = false;
- continue;
- }
- if (*it == "AND") {
- and_results = true;
- continue;
- }
- bool match = does_package_match_one (sel, *it);
- result = and_results ? result && match : result || match;
- }
- return result;
- }
-
- // callbacks
- static bool getSelectedPackage (GtkTreeView *tree_view,
- ZyppSelectablePtr *package_sel, GtkTreePath **_path = 0)
+private:
+ #define MIN_FREE_MB_WARN (80*1024)
+ virtual void update()
{
- IMPL
- GtkTreePath *path = 0;
- gtk_tree_view_get_cursor (tree_view, &path, NULL);
- if (path) {
- GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
+ GtkListStore *store = GTK_LIST_STORE (m_model);
+ gtk_list_store_clear (store);
+
+ int warn_part = -1;
+ Ypp::Disk *disk = Ypp::get()->getDisk();
+ for (int i = 0; disk->getPartition (i); i++) {
+ const Ypp::Disk::Partition *part = disk->getPartition (i);
+ long usage = (part->used * 100) / (part->total + 1);
+ std::string usage_str = part->used_str + " (of " + part->total_str + ")";
GtkTreeIter iter;
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, COL_SELECTABLE, package_sel, -1);
- if (_path)
- *_path = gtk_tree_model_filter_convert_path_to_child_path
- (GTK_TREE_MODEL_FILTER (model), path);
- gtk_tree_path_free (path);
- return true;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, part->path.c_str(), 1, usage,
+ 2, usage_str.c_str(), -1);
+ if (warn_part < 0 && (part->total > 1024 && part->total - part->used < MIN_FREE_MB_WARN))
+ warn_part = i;
}
- return false;
+ if (warn_part >= 0) {
+ warn();
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_widget), warn_part);
+ }
+ else
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_widget), 0);
}
- // For SLED10 / older gtk+'s ...
- static bool compat_gtk_tree_model_filter_convert_child_iter_to_iter (GtkTreeModelFilter *filter,
- GtkTreeIter *filter_iter,
- GtkTreeIter *child_iter)
- {
-#if GTK_CHECK_VERSION(2,10,0)
- return gtk_tree_model_filter_convert_child_iter_to_iter (filter, filter_iter, child_iter);
-#else // cut/paste from gtk+ HEAD...
- gboolean ret;
- GtkTreePath *child_path, *path;
-
- memset (filter_iter, 0, sizeof (GtkTreeIter));
-
- GtkTreeModel *child_model;
- g_object_get (G_OBJECT (filter), "child-model", &child_model, NULL);
- child_path = gtk_tree_model_get_path (child_model, child_iter);
- g_return_val_if_fail (child_path != NULL, FALSE);
-
- path = gtk_tree_model_filter_convert_child_path_to_path (filter,
- child_path);
- gtk_tree_path_free (child_path);
-
- if (!path)
- return FALSE;
+ void warn()
+ {
+ if (m_hasWarn) return;
+ m_hasWarn = true;
- ret = gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), filter_iter, path);
- gtk_tree_path_free (path);
+ GtkWidget *dialog, *view;
+ dialog = gtk_message_dialog_new (YGUI::ui()->currentWindow(),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK, _("Disk Almost Full !"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "One of the partitions is reaching its limit of capacity. You may "
+ "have to remove packages if you wish to install some.");
- return ret;
-#endif
- }
+ view = createView (m_model);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), view);
- static bool sync_tree_views_scroll (GtkTreeView *current_view, GtkTreeView *other_view,
- GtkTreePath *current_path, bool select_it)
- {
- /* What we do here is to scroll the other view to the correspondent
- package position. If the package isn't present in that view, we
- iterate it so we get the closest package (with respect to alphabetic
- sorting). */
-
- // converts the path from one model to the other
- GtkTreePath *_path, *other_path;
- _path = gtk_tree_model_filter_convert_path_to_child_path (
- GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (current_view)),
- current_path);
- if (!_path)
- return false;
-
- GtkTreeModel *base_model = gtk_tree_model_filter_get_model (
- GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (current_view)));
-
- GtkTreeIter iter, other_iter;
- gtk_tree_model_get_iter (base_model, &iter, _path);
- gtk_tree_path_free (_path);
-
- int timeout = 0;
- // Try to find a a similar item in the other view to synchronise with
- while (!compat_gtk_tree_model_filter_convert_child_iter_to_iter (
- GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (other_view)),
- &other_iter, &iter))
- {
- if (!gtk_tree_model_iter_next (base_model, &iter))
- return false;
- // This turns into N^3 very quickly if we search too hard
- if (timeout++ > 10)
- return false;
- select_it = false; // not the same package -- dont select it then
- }
-
- other_path = gtk_tree_model_get_path (gtk_tree_view_get_model (other_view),
- &other_iter);
-
- GdkRectangle cell_rect, visible_rect;
- gtk_tree_view_get_cell_area (other_view, other_path, NULL, &cell_rect);
- gtk_tree_view_get_visible_rect (other_view, &visible_rect);
- int y = visible_rect.y + cell_rect.y;
-
- gtk_tree_view_get_cell_area (current_view, current_path, NULL, &cell_rect);
- y -= cell_rect.y; // offset
-
- gtk_tree_view_expand_to_path (other_view, other_path);
- YGUtils::tree_view_smooth_scroll_to_point (other_view, 0, y);
- if (select_it)
- gtk_tree_selection_select_path (gtk_tree_view_get_selection (other_view),
- other_path);
- gtk_tree_path_free (other_path);
- return true;
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
}
- static void package_clicked_cb (GtkTreeSelection *selection, PackageSelector *pThis)
+ // utilities
+#if 1
+ static GtkWidget *createView (GtkTreeModel *model)
{
- IMPL
- int selected_rows = gtk_tree_selection_count_selected_rows (selection);
- if (selected_rows == 0)
- return;
-
- static bool safeguard = false;
- if (safeguard)
- return;
- safeguard = true;
+ GtkWidget *view = gtk_tree_view_new_with_model (model), *scroll;
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)),
+ GTK_SELECTION_NONE);
- GtkTreeView *tree_view = gtk_tree_selection_get_tree_view (selection);
- bool install_view = tree_view == GTK_TREE_VIEW (pThis->m_installed_view);
- GtkTreeView *other_view = GTK_TREE_VIEW (install_view ?
- pThis->m_available_view : pThis->m_installed_view);
-
- // unselect the other view
- gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (other_view));
-
- // select and scroll to the package in the other view (if it's listed there)
- GtkTreePath *path = 0;
- gtk_tree_view_get_cursor (tree_view, &path, NULL);
- if (path) {
- // function can be called to set some package visible
- gtk_tree_view_scroll_to_cell (tree_view, path, NULL, FALSE, 0, 0);
+ GtkTreeViewColumn *column;
+ column = gtk_tree_view_column_new_with_attributes (_("Mount Point"),
+ gtk_cell_renderer_text_new(), "text", 0, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ column = gtk_tree_view_column_new_with_attributes (_("Usage"),
+ gtk_cell_renderer_progress_new(), "value", 1, "text", 2, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
- sync_tree_views_scroll (tree_view, other_view, path, selected_rows == 1);
- gtk_tree_path_free (path);
- }
+ scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+// gtk_widget_set_size_request (scroll, -1, 50);
+ gtk_container_add (GTK_CONTAINER (scroll), view);
+ gtk_widget_show_all (scroll);
+ return scroll;
+ }
+#endif
+ static GtkWidget *createCombo (GtkTreeModel *model)
+ {
+ GtkWidget *combo = gtk_combo_box_new_with_model (model);
+ GtkCellRenderer *renderer;
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo),
+ renderer, "text", 0, NULL);
+ // let's put all columns to the same width, to make it look like a table
+ g_object_set (G_OBJECT (renderer), "width-chars", 14, NULL);
+ renderer = gtk_cell_renderer_progress_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo),
+ renderer, "value", 1, "text", 2, NULL);
+ return combo;
+ }
+};
- // show package information
- ZyppSelectablePtr sel = 0;
- getSelectedPackage (tree_view, &sel);
-
- ZyppObject install_obj, available_obj;
- induceObjects (sel, install_obj, available_obj, NULL, NULL);
-
- ZyppObject &obj = install_view ? install_obj : available_obj;
- pThis->m_information_widget->setPackage (sel, obj);
-
- // change the install/remove button label to upgrade, or etc
- GtkLabel *install_label = GTK_LABEL (pThis->m_install_label),
- *remove_label = GTK_LABEL (pThis->m_remove_label);
- if (selected_rows > 1) {
- gtk_label_set_text (install_label, _("_install"));
- gtk_label_set_text (remove_label, _("_remove"));
- }
- else { // personalize
- // remove label
- if (sel && sel->toInstall())
- gtk_label_set_text (remove_label, _("_undo"));
- else
- gtk_label_set_text (remove_label, _("_remove"));
- // install label
- if (sel && sel->toDelete())
- gtk_label_set_text (install_label, _("_undo"));
- else if (!install_obj)
- gtk_label_set_text (install_label, _("_install"));
- else if (available_obj) {
- int res = zypp::Edition::compare (install_obj->edition(),
- available_obj->edition());
- if (res < 0)
- gtk_label_set_text (install_label, _("_upgrade"));
- else if (res > 0)
- gtk_label_set_text (install_label, _("_downgrade"));
- else
- gtk_label_set_text (install_label, _("re-_install"));
- }
- }
- gtk_label_set_use_underline (install_label, TRUE);
- gtk_label_set_use_underline (remove_label, TRUE);
+class PackageSelector : public Filters::Listener, public PackagesView::Listener
+{
+PackagesView *m_packages;
+Filters *m_filters;
+PackageInfo *m_info;
+PackageControl *m_control;
+DiskView *m_disk;
+GtkWidget *m_box;
+TrashWindow *m_trashWin;
- safeguard = false;
- }
+public:
+ GtkWidget *getWidget()
+ { return m_box; }
- // install/remove/update/... selected packages
- void markSelectedPackage (GtkTreeView *view, bool available, bool installed)
+ PackageSelector()
{
- IMPL
- /* Since the filter model gets changed, get paths for the base model and
- then do our stuff. */
- GList *selected = gtk_tree_selection_get_selected_rows (
- gtk_tree_view_get_selection (view), NULL);
-
- int selected_len = g_list_length (selected);
- GtkTreeIter iters [selected_len];
-
- GtkTreeModel *filter_model = gtk_tree_view_get_model (view);
- GtkTreeModelFilter *filter = GTK_TREE_MODEL_FILTER (filter_model);
- GtkTreeModel *model = gtk_tree_model_filter_get_model (filter);
-
- int i = 0;
- for (GList *it = selected; it; it = it->next, i++) {
- GtkTreePath *path = (GtkTreePath *) it->data;
+ m_packages = new PackagesView();
+ m_packages->setListener (this);
- GtkTreeIter filter_iter, iter;
- gtk_tree_model_get_iter (filter_model, &filter_iter, path);
- gtk_tree_path_free (path);
+ m_control = new PackageControl();
+ m_info = new PackageInfo();
- gtk_tree_model_filter_convert_iter_to_child_iter (filter, &iter, &filter_iter);
- iters[i] = iter;
- }
- g_list_free (selected);
- for (i = 0; i < selected_len; i++) {
- GtkTreeIter *iter = &iters[i];
- ZyppSelectablePtr sel = 0;
- gtk_tree_model_get (model, iter, COL_SELECTABLE, &sel, -1);
- if (sel && mark_selectable (sel, installed) /* install/remove */) {
- loadPackageRow (model, iter, sel); // update model
-
- // mark also children (eg. for patterns and languages)
- GtkTreeIter child;
- if (gtk_tree_model_iter_children (model, &child, iter)) {
- do {
- gtk_tree_model_get (model, &child, COL_SELECTABLE, &sel, -1);
- if (sel && mark_selectable (sel, installed))
- loadPackageRow (model, &child, sel);
- } while (gtk_tree_model_iter_next (model, &child));
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), m_packages->getWidget(), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), m_control->getWidget(), FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), m_info->getWidget(), FALSE, TRUE, 0);
- }
- }
- }
+ m_filters = new Filters();
+ m_filters->setListener (this);
+ m_disk = new DiskView();
- m_disk_table->update();
+ GtkWidget *left_box = gtk_vbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (left_box), m_filters->getWidget(), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (left_box), m_disk->getWidget(), FALSE, TRUE, 0);
- // select path, so the buttons get updated and all (hacky)
- GtkTreeView *other_view = GTK_TREE_VIEW (
- GTK_WIDGET (view) == m_installed_view ? m_available_view : m_installed_view);
- package_clicked_cb (gtk_tree_view_get_selection (other_view), this);
+ m_box = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (m_box), left_box, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_box), vbox, TRUE, TRUE, 0);
+ gtk_widget_show_all (m_box);
+
+ m_control->setPackages (std::list <Ypp::Package*> ());
+ m_info->setPackage (NULL);
+
+ m_trashWin = new TrashWindow();
}
- static void install_button_clicked_cb (GtkButton *button, PackageSelector *pThis)
+ ~PackageSelector()
{
- IMPL
- pThis->markSelectedPackage (GTK_TREE_VIEW (pThis->m_available_view), false, true);
- gtk_widget_grab_focus (pThis->m_available_view);
+ delete m_packages;
+ delete m_control;
+ delete m_info;
+ delete m_filters;
+ delete m_disk;
+ delete m_trashWin;
}
- static void remove_button_clicked_cb (GtkButton *button, PackageSelector *pThis)
+ virtual void doQuery (Ypp::Query *query)
{
- IMPL
- pThis->markSelectedPackage (GTK_TREE_VIEW (pThis->m_installed_view), true, false);
- gtk_widget_grab_focus (pThis->m_installed_view);
+ m_packages->query (query);
}
- static void change_available_version_cb (YGtkCellRendererArrow *renderer,
- guint arrow_type, const gchar *_path, PackageSelector *pThis)
+ virtual void packagesSelected (const std::list <Ypp::Package *> &packages)
{
- GtkTreeModel *model = gtk_tree_view_get_model (
- GTK_TREE_VIEW (pThis->m_available_view));
- GtkTreePath *path = gtk_tree_path_new_from_string (_path);
- GtkTreeIter it;
- gtk_tree_model_get_iter (model, &it, path);
- gtk_tree_path_free (path);
-
- GtkTreeIter iter;
- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (model),
- &iter, &it);
- model = pThis->m_packages_model;
-
- ZyppSelectablePtr selectable;
- gtk_tree_model_get (model, &iter, COL_SELECTABLE, &selectable, -1);
-
- ZyppObject candidate = selectable->candidateObj();
- for (zypp::ui::Selectable::available_iterator it = selectable->availableBegin();
- it != selectable->availableEnd(); it++) {
- int cmp = zypp::Edition::compare ((*it)->edition(), candidate->edition());
- if (arrow_type == GTK_ARROW_UP) { // upgrade
- if (cmp > 0)
- candidate = *it;
- }
- else /*if (arrow_type == GTK_ARROW_DOWN)*/ { // downgrade
- if (cmp < 0)
- candidate = *it;
- }
- }
- if (!selectable->setCandidate (candidate))
- y2warning ("Error: Could not %sgrade\n", arrow_type == GTK_ARROW_UP ? "up" : "down");
- pThis->loadPackageRow (model, &iter, selectable);
+ m_control->setPackages (packages);
+ if (packages.size() == 1)
+ m_info->setPackage (packages.front());
+ else
+ m_info->setPackage (NULL);
}
- static gboolean dont_select_groups_cb (GtkTreeSelection *selection, GtkTreeModel *model,
- GtkTreePath *path, gboolean selected, gpointer data)
+ void packageModified (Ypp::Package *package)
{
- GtkTreeIter iter;
- if (gtk_tree_model_get_iter (model, &iter, path)) {
- ZyppSelectablePtr selectable;
- gtk_tree_model_get (model, &iter, COL_SELECTABLE, &selectable, -1);
- return selectable != NULL;
- }
- return FALSE;
+ // GTK+ doesn't fire selection change when a selected row changes, so we need
+ // to re-load PackageControl in that occasions.
+ std::list <Ypp::Package *>::iterator it;
+ for (it = m_control->m_packages.begin(); it != m_control->m_packages.end(); it++)
+ if (*it == package)
+ break;
+ if (it != m_control->m_packages.end())
+ m_control->setPackages (m_control->m_packages);
}
};
-// The ordinary package selector that displays all packages
-class YGPackageSelector : public YPackageSelector, public YGWidget
-{
- PackageSelector *m_package_selector;
-
- static bool confirm_cb (void *pThis)
- {
- return ((YGPackageSelector *)pThis)->checkDelete();
- }
-
- bool checkDelete()
- {
- bool changed =
- zyppPool().diffState<zypp::Package >() ||
- zyppPool().diffState<zypp::Pattern >() ||
- zyppPool().diffState<zypp::Selection>() ||
- zyppPool().diffState<zypp::Language >() ||
- zyppPool().diffState<zypp::Patch >();
- if (!changed)
- return true;
+#include "YPackageSelector.h"
- GtkWidget *dialog;
- dialog = gtk_message_dialog_new_with_markup
- (YGUI::ui()->currentWindow(),
- GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE, _("<b>Abandon all changes?</b>"));
- gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
- GTK_STOCK_QUIT, GTK_RESPONSE_YES, NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog),
- GTK_RESPONSE_NO);
- bool ok = gtk_dialog_run (GTK_DIALOG (dialog)) ==
- GTK_RESPONSE_YES;
- gtk_widget_destroy (dialog);
- return ok;
- }
+class YGPackageSelector : public YPackageSelector, public YGWidget, public Ypp::Interface
+{
+PackageSelector *m_package_selector;
public:
YGPackageSelector (const YWidgetOpt &opt, YGWidget *parent)
@@ -2422,27 +1385,19 @@
YGWidget (this, parent, true, YGTK_TYPE_WIZARD, NULL)
{
setBorder (0);
-
YGDialog *dialog = YGUI::ui()->currentYGDialog();
dialog->setCloseCallback (confirm_cb, this);
- GtkWindow *window = dialog->getWindow();
- gtk_window_resize (window, MAX (680, GTK_WIDGET (window)->allocation.width),
+
+ GtkWindow *window = dialog->getWindow();
+ gtk_window_resize (window, GTK_WIDGET (window)->allocation.width,
MAX (580, GTK_WIDGET (window)->allocation.height));
YGtkWizard *wizard = YGTK_WIZARD (getWidget());
-
ygtk_wizard_set_header_icon (wizard, window,
THEMEDIR "/icons/32x32/apps/yast-software.png");
- ygtk_wizard_set_header_text (wizard, window, "Package Selector");
+ ygtk_wizard_set_header_text (wizard, window, _("Package Selector"));
ygtk_wizard_set_help_text (wizard,
- _("Two pools are presented; one with the available software, the other "
- "with the installed one. To install software you choose a package "
- "from the install pool and press Install. Similar method for removal "
- "of software. When you are done press the Accept button.<br>"
- "Information on a given package is displayed on the Package Information "
- "expander at the bottom which may be enlarged.<br>"
- "A categories view of the software is possible, as well as searching "
- "for a given package.")
+ _("TO WRITE")
);
ygtk_wizard_set_abort_button_label (wizard, _("_Cancel"));
@@ -2453,15 +1408,16 @@
g_signal_connect (G_OBJECT (getWidget()), "action-triggered",
G_CALLBACK (wizard_action_cb), this);
- m_package_selector = new PackageSelector (!opt.searchMode.value());
+ m_package_selector = new PackageSelector();
gtk_container_add (GTK_CONTAINER (wizard), m_package_selector->getWidget());
+
+ Ypp::get()->setInterface (this);
}
virtual ~YGPackageSelector()
{
- YGDialog *dialog = YGUI::ui()->currentYGDialog();
- dialog->unsetCloseCallback();
delete m_package_selector;
+ ygtk_zypp_model_finish();
}
protected:
@@ -2472,201 +1428,334 @@
const gchar *action = (gchar *) id;
if (!strcmp (action, "accept")) {
- if (zyppPool().diffState <zypp::Package> ()) {
- // in case of changes, check problems, ask for confirmation and JFDI.
- if (pThis->confirmChanges() && solveProblems()) {
- y2milestone ("Closing PackageSelector with 'accept'");
- YGUI::ui()->sendEvent (new YMenuEvent (YCPSymbol ("accept")));
- }
- }
- else
- YGUI::ui()->sendEvent (new YCancelEvent());
+ y2milestone ("Closing PackageSelector with 'accept'");
+ YGUI::ui()->sendEvent (new YMenuEvent (YCPSymbol ("accept")));
}
else if (!strcmp (action, "cancel")) {
y2milestone ("Closing PackageSelector with 'cancel'");
- if (pThis->checkDelete())
- YGUI::ui()->sendEvent (new YCancelEvent());
+ if (pThis->confirmExit())
+ YGUI::ui()->sendEvent (new YCancelEvent());
}
}
- // helper function for confirmChanges
- static bool isInstalled (const string &package)
- {
- for (ZyppPool::const_iterator it = zyppPool().byKindBegin <zypp::Package>();
- it != zyppPool().byKindEnd <zypp::Package>(); it++) {
- if ((*it)->hasInstalledObj() || (*it)->toInstall()) {
- if (package == (*it)->name())
- return true;
- ZyppObject obj = (*it)->theObj();
- const zypp::CapSet &caps = obj->dep (zypp::Dep::PROVIDES);
- for (zypp::CapSet::const_iterator jt = caps.begin();
- jt != caps.end(); jt++)
- if (package == jt->asString())
- return true;
- }
- }
- return false; // doesn't even exist
- }
+ bool confirmExit()
+ {
+ if (!Ypp::get()->isModified())
+ return true;
+
+ GtkWidget *dialog;
+ dialog = gtk_message_dialog_new
+ (YGUI::ui()->currentWindow(),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE, _("Changes not saved!"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ _("Quit anyway?"));
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
+ GTK_STOCK_QUIT, GTK_RESPONSE_YES, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
+
+ bool ok = gtk_dialog_run (GTK_DIALOG (dialog)) ==
+ GTK_RESPONSE_YES;
+ gtk_widget_destroy (dialog);
+ return ok;
+ }
+ static bool confirm_cb (void *pThis)
+ { return ((YGPackageSelector *)pThis)->confirmExit(); }
- bool confirmChanges()
+ virtual bool acceptLicense (Ypp::Package *package, const std::string &license)
{
- IMPL
- if (zyppPool().empty <zypp::Package> ())
- return false;
+ std::string title = package->name() + _(" License Agreement");
+ GtkWidget *dialog = gtk_dialog_new_with_buttons (title.c_str(),
+ YGUI::ui()->currentWindow(), GTK_DIALOG_NO_SEPARATOR,
+ _("_Reject"), GTK_RESPONSE_REJECT, _("_Accept"), GTK_RESPONSE_ACCEPT, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
- GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Changes Summary"),
- YGUI::ui()->currentWindow(),
- GtkDialogFlags (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("C_onfirm"), GTK_RESPONSE_ACCEPT, NULL);
-
- GtkWidget *install_label, *remove_label, *install_view, *remove_view;
- install_label = gtk_label_new (_("To install:"));
- remove_label = gtk_label_new (_("To remove:"));
- install_view = gtk_tree_view_new();
- remove_view = gtk_tree_view_new();
-
- GtkWidget *install_window, *remove_window;
- install_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (install_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type
- (GTK_SCROLLED_WINDOW (install_window), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (install_window), install_view);
- remove_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (remove_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ GtkWidget *license_view, *license_window;
+
+ license_view = ygtk_html_wrap_new();
+ ygtk_html_wrap_set_text (license_view, license.c_str());
+
+ license_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (license_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type
- (GTK_SCROLLED_WINDOW (remove_window), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (remove_window), remove_view);
+ (GTK_SCROLLED_WINDOW (license_window), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (license_window), license_view);
GtkBox *vbox = GTK_BOX (GTK_DIALOG(dialog)->vbox);
- gtk_box_pack_start (vbox, install_label, FALSE, FALSE, 6);
- gtk_box_pack_start (vbox, install_window, TRUE, TRUE, 6);
- gtk_box_pack_start (vbox, remove_label, FALSE, FALSE, 6);
- gtk_box_pack_start (vbox, remove_window, TRUE, TRUE, 6);
+ gtk_box_pack_start (vbox, license_window, TRUE, TRUE, 6);
- // create model
- {
- GtkTreeStore *install_store = gtk_tree_store_new (1, G_TYPE_STRING);
- GtkTreeStore *remove_store = gtk_tree_store_new (1, G_TYPE_STRING);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 400);
+ gtk_widget_show_all (dialog);
- // install view
- GtkTreeViewColumn *column;
- column = gtk_tree_view_column_new_with_attributes (_("Install packages"),
- gtk_cell_renderer_text_new(), "text", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (install_view), column);
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (install_view), FALSE);
- gtk_tree_view_set_model (GTK_TREE_VIEW (install_view),
- GTK_TREE_MODEL (install_store));
- g_object_unref (G_OBJECT (install_store));
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
- GTK_TREE_VIEW (install_view)), GTK_SELECTION_NONE);;
-
- // remove view
- column = gtk_tree_view_column_new_with_attributes (_("Remove packages"),
- gtk_cell_renderer_text_new(), "text", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (remove_view), column);
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (remove_view), FALSE);
- gtk_tree_view_set_model (GTK_TREE_VIEW (remove_view),
- GTK_TREE_MODEL (remove_store));
- g_object_unref (G_OBJECT (remove_store));
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
- GTK_TREE_VIEW (remove_view)), GTK_SELECTION_NONE);;
-
- // construct model
- for (ZyppPool::const_iterator it = zyppPool().byKindBegin <zypp::Package>();
- it != zyppPool().byKindEnd <zypp::Package>(); it++)
+ gint ret = gtk_dialog_run (GTK_DIALOG (dialog));
+ bool confirmed = (ret == GTK_RESPONSE_ACCEPT);
+
+ gtk_widget_destroy (dialog);
+ return confirmed;
+ }
+
+ virtual bool resolveProblems (std::list <Ypp::Problem *> problems)
+ {
+fprintf (stderr, "resolving %d problems\n", problems.size());
+ // we can't use ordinary radio buttons, as gtk+ enforces that in a group
+ // one must be selected...
+
+ enum ColumnAlias {
+ SHOW_TOGGLE_COL, ACTIVE_TOGGLE_COL, TEXT_COL, WEIGHT_TEXT_COL,
+ APPLY_PTR_COL, TOOLTIP_TEXT_COL
+ };
+
+ struct inner {
+ static void solution_toggled (GtkTreeModel *model, GtkTreePath *path)
{
- ZyppSelectable selectable = *it;
- if (!selectable)
- continue;
-
- GtkTreeStore *store;
- if (selectable->toInstall())
- store = install_store;
- else if (selectable->toDelete())
- store = remove_store;
- else continue;
+ GtkTreeStore *store = GTK_TREE_STORE (model);
+ GtkTreeIter iter, parent;
- GtkTreeIter iter;
- gtk_tree_store_append (store, &iter, NULL);
- gtk_tree_store_set (store, &iter, 0, selectable->name().c_str(), -1);
+ gboolean enabled;
+ bool *apply;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, ACTIVE_TOGGLE_COL, &enabled,
+ APPLY_PTR_COL, &apply, -1);
+
+ // disable all the other radios on the group, setting current
+ gtk_tree_model_get_iter (model, &iter, path);
+ if (gtk_tree_model_iter_parent (model, &parent, &iter)) {
+ gtk_tree_model_iter_children (model, &iter, &parent);
+ do {
+ gtk_tree_store_set (store, &iter, ACTIVE_TOGGLE_COL, FALSE, -1);
+ bool *apply;
+ gtk_tree_model_get (model, &iter, APPLY_PTR_COL, &apply, -1);
+ *apply = false;
+ } while (gtk_tree_model_iter_next (model, &iter));
+ }
- // show dependencies -- we just ask Zypp for dependencies in the form
- // of a string (which is the only way to do it anyway).
- if (store == install_store) {
- GtkTreeIter dep_iter;
- ZyppObject object = selectable->theObj();
- const zypp::CapSet &capSet = object->dep (zypp::Dep::REQUIRES);
- for (zypp::CapSet::const_iterator it = capSet.begin();
- it != capSet.end(); it++) {
- // don't show if it is already installed
- if (isInstalled (it->asString()))
- continue;
-
- gtk_tree_store_append (store, &dep_iter, &iter);
- gtk_tree_store_set (store, &dep_iter,
- 0, it->asString().c_str(), -1);
- }
+ enabled = !enabled;
+ if (apply)
+ *apply = enabled;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_store_set (store, &iter, ACTIVE_TOGGLE_COL, enabled, -1);
+ }
+#if 0
+ static void renderer_toggled_cb (GtkCellRenderer *render, gchar *path_str,
+ GtkTreeModel *model)
+ {
+ GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+ solution_toggled (model, path);
+ gtk_tree_path_free (path);
+ }
+#endif
+ static void cursor_changed_cb (GtkTreeView *view, GtkTreeModel *model)
+ {
+ GtkTreePath *path;
+ gtk_tree_view_get_cursor (view, &path, NULL);
+ solution_toggled (model, path);
+ gtk_tree_path_free (path);
+ }
+ static gboolean query_tooltip_cb (GtkWidget *view, gint x, gint y,
+ gboolean keyboard_mode, GtkTooltip *tooltip, gpointer data)
+ {
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ if (gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view),
+ &x, &y, keyboard_mode, &model, &path, &iter)) {
+ gchar *tooltip_str;
+ gtk_tree_model_get (model, &iter, TOOLTIP_TEXT_COL,
+ &tooltip_str, -1);
+ gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (view), tooltip, path);
+ gtk_tree_path_free (path);
+ if (tooltip_str) {
+ gtk_tooltip_set_text (tooltip, tooltip_str);
+ g_free (tooltip_str);
+ return TRUE;
}
+ }
+ return FALSE;
- // show packages that require this -- we will need to iterate through
- // all the packages... (not very accurate)
- else {
- GtkTreeIter req_iter;
-
- for (ZyppPool::const_iterator it =
- zyppPool().byKindBegin <zypp::Package>();
- it != zyppPool().byKindEnd <zypp::Package>(); it++) {
- // only show if it is installed
- if ((*it)->hasInstalledObj() || (*it)->toInstall()) {
- ZyppSelectable dep_selectable = *it;
- ZyppObject dep_object = dep_selectable->theObj();
-
- const zypp::CapSet &capSet = dep_object->dep (zypp::Dep::REQUIRES);
- for (zypp::CapSet::const_iterator it = capSet.begin();
- it != capSet.end(); it++) {
- if (it->asString() == selectable->name()) {
- gtk_tree_store_append (store, &req_iter, &iter);
- gtk_tree_store_set (store, &req_iter,
- 0, dep_selectable->name().c_str(), -1);
- break;
- }
- }
- }
- }
+
+/*
+ GtkTreePath *path;
+ if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (view), x, y,
+ &path, NULL, NULL, NULL)) {
+ GtkTreeIter iter;
+ gchar *tooltip_text;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_path_free (path);
+ gtk_tree_model_get (model, &iter,
+ TOOLTIP_TEXT_COL, &tooltip_text, -1);
+ // some strings are just " ", so we need to check that
+ // now,
+ bool empty = true;
+ for (int i = 0; tooltip_text[i] && empty; i++)
+ if (tooltip_text[i] != ' ')
+ empty = false;
+ if (empty)
+ gtk_tooltip_set_text (tooltip, "(no details)");
+ else
+ gtk_tooltip_set_text (tooltip, tooltip_text);
+ g_free (tooltip_text);
+ return TRUE;
}
+ return FALSE;
+*/
+ }
+ };
+
+ // model
+ GtkTreeStore *store = gtk_tree_store_new (6, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
+ G_TYPE_STRING, G_TYPE_INT, G_TYPE_POINTER, G_TYPE_STRING);
+ for (std::list <Ypp::Problem *>::iterator it = problems.begin();
+ it != problems.end(); it++) {
+ GtkTreeIter problem_iter;
+ gtk_tree_store_append (store, &problem_iter, NULL);
+ gtk_tree_store_set (store, &problem_iter, SHOW_TOGGLE_COL, FALSE,
+ TEXT_COL, (*it)->description.c_str(),
+ WEIGHT_TEXT_COL, PANGO_WEIGHT_BOLD, APPLY_PTR_COL, NULL,
+ TOOLTIP_TEXT_COL, (*it)->details.c_str(), -1);
+
+ for (int i = 0; (*it)->getSolution (i); i++) {
+ Ypp::Problem::Solution *solution = (*it)->getSolution (i);
+ GtkTreeIter solution_iter;
+ const gchar *tooltip_text = solution->details.c_str();
+ if (solution->details.empty())
+ tooltip_text = NULL;
+ gtk_tree_store_append (store, &solution_iter, &problem_iter);
+ gtk_tree_store_set (store, &solution_iter, SHOW_TOGGLE_COL, TRUE,
+ ACTIVE_TOGGLE_COL, FALSE, TEXT_COL, solution->description.c_str(),
+ APPLY_PTR_COL, &solution->apply,
+ TOOLTIP_TEXT_COL, tooltip_text, -1);
+ }
+ }
+
+ // interface
+ GtkWidget *dialog = gtk_message_dialog_new (YGUI::ui()->currentWindow(),
+ GtkDialogFlags (0), GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
+ _("There are some conflicts on the transaction that must be "
+ "solved manually."));
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY);
+
+ GtkWidget *view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+ g_object_unref (G_OBJECT (store));
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (view)), GTK_SELECTION_NONE);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (view), TEXT_COL);
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ renderer = gtk_cell_renderer_toggle_new();
+ gtk_cell_renderer_toggle_set_radio (
+ GTK_CELL_RENDERER_TOGGLE (renderer), TRUE);
+/* g_signal_connect (G_OBJECT (renderer), "toggled",
+ G_CALLBACK (inner::renderer_toggled_cb), store);*/
+ // we should not connect the actual toggle button, as we toggle on row press
+ g_signal_connect (G_OBJECT (view), "cursor-changed",
+ G_CALLBACK (inner::cursor_changed_cb), store);
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "visible", SHOW_TOGGLE_COL, "active", ACTIVE_TOGGLE_COL, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "text", TEXT_COL, "weight", WEIGHT_TEXT_COL, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
+ gtk_widget_set_has_tooltip (view, TRUE);
+ g_signal_connect (G_OBJECT (view), "query-tooltip",
+ G_CALLBACK (inner::query_tooltip_cb), store);
+
+ 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_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
+ GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (scroll), view);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll);
+
+
+#if 0
+ // version that uses viewport, labels and radio buttons -- unfortunately,
+ // gtk+ enforces that one radio button per group to be selected -- we don't
+ // want that as the user may decide to do nothing for a certain action.
+ // We also don't want to add a "Do nothing" radio, as that would imply would
+ // dismiss the conflict. No, we just want to let the user try to resolve current
+ // conflicts...
+ struct inner {
+ static void solution_toggled (GtkToggleButton *toggle, bool *apply)
+ { *apply = gtk_toggle_button_get_active (toggle); }
+ };
+
+ GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Problem Resolver"),
+ YGUI::ui()->currentWindow(), GtkDialogFlags (0),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, NULL);
+
+ GtkWidget *view_port = gtk_viewport_new (NULL, NULL);
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (view_port), GTK_SHADOW_NONE);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), view_port,
+ TRUE, TRUE, 0);
+ GtkWidget *main_box = gtk_vbox_new (FALSE, 6);
+ gtk_container_add (GTK_CONTAINER (view_port), main_box);
+
+fprintf (stderr, "populating main box\n");
+ for (std::list <Ypp::Problem *>::iterator it = problems.begin();
+ it != problems.end(); it++) {
+ GtkWidget *label, *box;
+fprintf (stderr, "creating label: %s\n", (*it)->description.c_str());
+ label = gtk_label_new ((*it)->description.c_str());
+ YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+fprintf (stderr, "setting tooltyp: %s\n", (*it)->details.c_str());
+ if (!(*it)->details.empty())
+ gtk_widget_set_tooltip_text (label, (*it)->details.c_str());
+
+ GSList *group = NULL;
+ box = gtk_vbox_new (FALSE, 6);
+ for (int i = 0; (*it)->getSolution (i); i++) {
+ Ypp::Problem::Solution *solution = (*it)->getSolution (i);
+fprintf (stderr, "creating radio: %s\n", solution->description.c_str());
+ GtkWidget *radio = gtk_radio_button_new_with_label (
+ group, solution->description.c_str());
+fprintf (stderr, "setting tooltip: %s\n", (*it)->details.c_str());
+ if (!solution->details.empty())
+ gtk_widget_set_tooltip_text (radio, solution->details.c_str());
+ group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
+ gtk_box_pack_start (GTK_BOX (box), radio, FALSE, TRUE, 0);
+ g_signal_connect (G_OBJECT (radio), "toggled",
+ G_CALLBACK (inner::solution_toggled), &solution->apply);
}
+
+ gtk_box_pack_start (GTK_BOX (main_box), label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (main_box), box, FALSE, TRUE, 0);
}
+#endif
- gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400);
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 480);
gtk_widget_show_all (dialog);
- bool confirmed = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+ bool apply = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_APPLY);
gtk_widget_destroy (dialog);
+ return apply;
+ }
- return confirmed;
+ virtual void packageModified (Ypp::Package *package)
+ {
+ m_package_selector->packageModified (package);
}
YGWIDGET_IMPL_COMMON
};
-#endif /*DISABLE_PACKAGE_SELECTOR*/
YWidget *
YGUI::createPackageSelector (YWidget *parent, YWidgetOpt &opt,
const YCPString &floppyDevice)
{
- // TODO: floppyDevice really needed?
-#ifndef DISABLE_PACKAGE_SELECTOR
- if (opt.youMode.value())
+/* if (opt.youMode.value())
return new YGPatchSelector (opt, YGWidget::get (parent));
- else
+ else*/
return new YGPackageSelector (opt, YGWidget::get (parent));
-#else
- return NULL;
-#endif
}
YWidget *
Modified: trunk/gtk/src/YGProgressBar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGProgressBar.cc?rev=432…
==============================================================================
--- trunk/gtk/src/YGProgressBar.cc (original)
+++ trunk/gtk/src/YGProgressBar.cc Thu Dec 20 21:36:55 2007
@@ -120,8 +120,7 @@
{
// ygtk_ratio_box_set_homogeneous (YGTK_RATIO_BOX (getWidget()), TRUE);
ygtk_ratio_box_set_spacing (YGTK_RATIO_BOX (getWidget()), 2);
-
- for (int i = segments()-1; i >= 0; i--) {
+ for (int s = 0; s < segments(); s++) {
GtkWidget* bar = gtk_progress_bar_new();
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (bar),
horizontal ? GTK_PROGRESS_LEFT_TO_RIGHT : GTK_PROGRESS_BOTTOM_TO_TOP);
@@ -132,7 +131,7 @@
else
gtk_widget_set_size_request (bar, -1, min_size);
ygtk_ratio_box_pack (YGTK_RATIO_BOX (getWidget()), bar,
- maxValue (i), TRUE, TRUE, 0);
+ getSegmentWeight (s), TRUE, TRUE, 0);
}
ygtk_adj_size_set_max (YGTK_ADJ_SIZE (m_adj_size), horizontal ? 200 : 0,
@@ -143,17 +142,29 @@
virtual void doUpdate()
{
GList* children = gtk_container_get_children (GTK_CONTAINER (getWidget()));
- int n = segments()-1;
- for (GList *i = children; i && n >= 0; i = i->next, n--) {
+ int s = 0;
+ for (GList *i = children; i && s < segments(); i = i->next, s++) {
GtkProgressBar *bar = GTK_PROGRESS_BAR (i->data);
- gfloat fraction = 0;
- if (currentValue (n) != -1)
- fraction = 1.0 - ((gfloat) currentValue(n) / maxValue(n));
- gtk_progress_bar_set_fraction (bar, fraction);
+ gtk_progress_bar_set_fraction (bar, getSegmentValue (s));
}
g_list_free (children);
}
+ int getSegmentWeight (int n)
+ {
+ if (vertical())
+ n = (segments() - n) - 1;
+ return maxValue (n);
+ }
+ float getSegmentValue (int n)
+ {
+ if (vertical())
+ n = (segments() - n) - 1;
+ if (currentValue (n) == -1)
+ return 0;
+ return 1.0 - (((float) currentValue (n)) / maxValue (n));
+ }
+
YGWIDGET_IMPL_COMMON
};
Modified: trunk/gtk/src/YGPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=4321…
==============================================================================
--- trunk/gtk/src/YGPushButton.cc (original)
+++ trunk/gtk/src/YGPushButton.cc Thu Dec 20 21:36:55 2007
@@ -30,8 +30,6 @@
G_CALLBACK (set_default_cb), this);
}
- virtual ~YGPushButton() {}
-
// YPushButton
virtual void setLabel (const YCPString &label)
{
Modified: trunk/gtk/src/YGUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=43212&r1=432…
==============================================================================
--- trunk/gtk/src/YGUI.cc (original)
+++ trunk/gtk/src/YGUI.cc Thu Dec 20 21:36:55 2007
@@ -644,9 +644,7 @@
// debug dialogs
-static void destroy_dialog (GtkDialog *dialog, gint arg)
-{ IMPL; gtk_widget_destroy (GTK_WIDGET (dialog)); }
-
+//#define IS_VALID_COL
void dumpYastTree (YWidget *widget)
{
IMPL
@@ -667,7 +665,11 @@
gchar *weight = g_strdup_printf ("%ld x %ld",
widget->weight (YD_HORIZ), widget->weight (YD_VERT));
gtk_tree_store_set (store, &iter, 0, widget->widgetClass(),
- 1, ygwidget->getDebugLabel().c_str(), 2, stretch, 3, weight, -1);
+ 1, ygwidget->getDebugLabel().c_str(), 2, stretch, 3, weight,
+#ifdef IS_VALID_COL
+ 4, widget->isValid(),
+#endif
+ -1);
g_free (stretch);
g_free (weight);
@@ -675,14 +677,37 @@
for (int i = 0; i < container->numChildren(); i++)
dumpYastTree (container->child (i), store, &iter);
}
+ static void dialog_response_cb (GtkDialog *dialog, gint response, YWidget *ywidget)
+ {
+ if (response == 1) {
+ GtkTreeStore *store;
+ GtkTreeView *view;
+ store = (GtkTreeStore *) g_object_get_data (G_OBJECT (dialog), "store");
+ view = (GtkTreeView *) g_object_get_data (G_OBJECT (dialog), "view");
+ gtk_tree_store_clear (store);
+ dumpYastTree (ywidget, store, NULL);
+ gtk_tree_view_expand_all (view);
+ }
+ else
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ }
};
- GtkTreeStore *store = gtk_tree_store_new (4, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING);
- inner::dumpYastTree (widget, store, NULL);
+ int cols = 4;
+#ifdef IS_VALID_COL
+ cols++;
+#endif
+ GtkTreeStore *store = gtk_tree_store_new (cols,
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING
+#ifdef IS_VALID_COL
+ , G_TYPE_BOOLEAN
+#endif
+ );
GtkWidget *dialog = gtk_dialog_new_with_buttons ("YWidgets Tree", NULL,
- GtkDialogFlags (GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+ GtkDialogFlags (GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_REFRESH, 1,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 400);
GtkWidget *view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
@@ -692,13 +717,19 @@
gtk_tree_view_append_column (GTK_TREE_VIEW (view),
gtk_tree_view_column_new_with_attributes ("Label",
gtk_cell_renderer_text_new(), "text", 1, NULL));
+ gtk_tree_view_column_set_expand (gtk_tree_view_get_column (
+ GTK_TREE_VIEW (view), 1), TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (view),
gtk_tree_view_column_new_with_attributes ("Stretch",
gtk_cell_renderer_text_new(), "text", 2, NULL));
gtk_tree_view_append_column (GTK_TREE_VIEW (view),
gtk_tree_view_column_new_with_attributes ("Weight",
gtk_cell_renderer_text_new(), "text", 3, NULL));
- gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
+#ifdef IS_VALID_COL
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view),
+ gtk_tree_view_column_new_with_attributes ("Valid",
+ gtk_cell_renderer_toggle_new(), "active", 4, NULL));
+#endif
gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW (view), TRUE);
GtkWidget *scroll_win = gtk_scrolled_window_new (NULL, NULL);
@@ -709,10 +740,16 @@
gtk_container_add (GTK_CONTAINER (scroll_win), view);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll_win);
- gtk_widget_show_all (dialog);
+ inner::dumpYastTree (widget, store, NULL);
+ gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
+
+ g_object_set_data (G_OBJECT (dialog), "view", view);
+ g_object_set_data (G_OBJECT (dialog), "store", store);
g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (destroy_dialog), 0);
+ G_CALLBACK (inner::dialog_response_cb), widget);
+
+ gtk_widget_show_all (dialog);
}
#include <YRichText.h>
@@ -754,6 +791,8 @@
for (int i = 0; i < container->numChildren(); i++)
dumpYastHtml (container->child (i), box);
}
+ static void destroy_dialog (GtkDialog *dialog, gint arg)
+ { gtk_widget_destroy (GTK_WIDGET (dialog)); }
};
IMPL
@@ -765,6 +804,6 @@
gtk_widget_show_all (dialog);
g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (destroy_dialog), 0);
+ G_CALLBACK (inner::destroy_dialog), 0);
}
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=43212&r1=…
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Thu Dec 20 21:36:55 2007
@@ -66,6 +66,8 @@
void YGUtils::replace (string &str, const char *mouth, int mouth_len, const char *food)
{
+ if (mouth_len < 0)
+ mouth_len = strlen (mouth);
unsigned int i = 0;
while ((i = str.find (mouth, i)) != string::npos)
{
@@ -87,83 +89,27 @@
gtk_text_buffer_delete_mark (buffer, end_mark);
}
-/* Strings can ask for not being escape with the comment
- <!-- DT:Rich --> */
-static bool dont_escape (const string &str)
-{
- const char *comment = "<!-- DT:Rich -->";
- if (str.length() < sizeof (comment))
- return false;
- for (unsigned int i = 0; i < sizeof (comment); i++)
- if (str[i] != comment[i])
- return false;
- return true;
-}
-
-string YGUtils::escape_markup (const string &str, bool break_lines)
+void YGUtils::escapeMarkup (string &str)
{
- if (dont_escape (str))
- return string (str);
-
- string ret;
- ret.reserve (str.length());
for (unsigned int i = 0; i < str.length(); i++) {
- char ch = str[i];
- switch (ch) {
+ switch (str[i]) {
case '<':
- ret += "<";
+ str.erase (i, 1);
+ str.insert (i, "<");
break;
case '>':
- ret += ">";
+ str.erase (i, 1);
+ str.insert (i, ">");
break;
case '&':
- ret += "&";
- break;
- case '\n':
- ret += "<br/>";
+ str.erase (i, 1);
+ str.insert (i, "&");
break;
default:
- ret += ch;
break;
}
}
-
- return ret;
-}
-
-#if 0
-string YGUtils::escape_break_lines (const string &str, bool paragraph_mode)
-{
- if (dont_escape (str))
- return str;
- string res;
- res.reserve (str.length() + 6);
- if (paragraph_mode)
- res = "<p>";
- /* on paragraph mode, dont break when there is no text on the paragraph.
- otherwise, just dont break at the start of the text. */
- bool dont_break = true;
- for (unsigned int i = 0; i != str.length(); i++) {
- char ch = str[i];
- if (paragraph_mode && ch == '\n' && str[i-1] == '\n') {
- if (!dont_break)
- res += "</p><p>";
- dont_break = true;
- }
- else if (!paragraph_mode && ch == '\n') {
- if (!dont_break)
- res += "<br>";
- }
- else {
- res += ch;
- dont_break = false;
- }
- }
- if (paragraph_mode)
- res += "</p>";
- return res;
}
-#endif
#define PROD_ENTITY "&product;"
@@ -503,7 +449,9 @@
{
std::list <string> parts;
unsigned int i, j;
- for (j = 0, i = 0; i < str.length(); i++)
+ // ignore first character, if separator
+ i = j = (str[0] == separator) ? 1 : 0;
+ for (; i < str.length(); i++)
if (str[i] == separator) {
parts.push_back (str.substr (j, i - j));
j = ++i;
Modified: trunk/gtk/src/YGUtils.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.h?rev=43212&r1=4…
==============================================================================
--- trunk/gtk/src/YGUtils.h (original)
+++ trunk/gtk/src/YGUtils.h Thu Dec 20 21:36:55 2007
@@ -9,6 +9,14 @@
#include <list>
#include <gtk/gtktextview.h>
#include <gtk/gtkeditable.h>
+#include <gtk/gtktreeview.h>
+#include <gtk/gtktreemodel.h>
+#include <gtk/gtkcellrenderertoggle.h>
+
+// TODO: do a cleanup here. We should probably split string, gtk and stuff
+// Some GtkTreeView should probably go to their own files
+// Let's avoid GTK+ stuff, better to replicate that, if needed, than leave in
+// this general purpose utils.
/* YGUtils.h/cc have some functionality that is shared between different parts
of the code. */
@@ -16,13 +24,13 @@
namespace YGUtils
{
/* Replaces Yast's '&' accelerator by Gnome's '_' (and proper escaping). */
- string mapKBAccel (const char *src);
+ std::string mapKBAccel (const char *src);
/* Filters characters that are not on the valids_chars array from the text string
Length is used to tell the length of text, in case it isn't NUL
terminated (you may pass -1, if it is).
Use the compare string member if you want to see if there was any change. */
- string filterText (const char* text, int length, const char* valid_chars);
+ std::string filterText (const char* text, int length, const char* valid_chars);
/* Convenience call for widgets that implement GtkEditable interface.
This function inserts and deletes text, if needed, so you may want
@@ -31,11 +39,10 @@
const char *valid_chars);
/* Replaces every 'mouth' by 'food' in 'str'. */
- void replace (string &str, const char *mouth, int mouth_len, const char *food);
+ void replace (std::string &str, const char *mouth, int mouth_len, const char *food);
- /* Escapes markup text (eg. changes '<' by '\<').
- If break_line is true, the break line character will be transformed in <br/> */
- string escape_markup (const string &str, bool break_line = false);
+ /* Escapes markup text (eg. changes '<' by '\<'). */
+ void escapeMarkup (std::string &str);
/* Adds functionality to GtkTextView to scroll to bottom. */
void scrollTextViewDown(GtkTextView *text_view);
@@ -52,11 +59,11 @@
int strcmp (const char *str1, const char *str2);
/* Checks if a std::string contains some other string (case insensitive). */
- bool contains (const string &haystack, const string &needle);
+ bool contains (const std::string &haystack, const std::string &needle);
/* Splits a string into parts as separated by the separator characters.
eg: splitString ("Office/Writer", '/') => { "Office", "Writer" } */
- std::list <string> splitString (const string &str, char separator);
+ std::list <std::string> splitString (const std::string &str, char separator);
/* Prints a GtkTreeModel for debugging purposes. */
void print_model (GtkTreeModel *model, int string_col);
Modified: trunk/gtk/src/YGWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWizard.cc?rev=43212&r1…
==============================================================================
--- trunk/gtk/src/YGWizard.cc (original)
+++ trunk/gtk/src/YGWizard.cc Thu Dec 20 21:36:55 2007
@@ -128,11 +128,9 @@
G_CALLBACK (action_triggered_cb), this);
}
- ~YGWizard()
+ virtual ~YGWizard()
{
- delete m_back_button;
- delete m_abort_button;
- delete m_next_button;
+ // m_back/abort/next_button are added as children and will be freed by ~YContainerWidget
}
/* The purpose of this function is to do some sanity checks, besides
Modified: trunk/gtk/src/ygdkmngloader.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygdkmngloader.c?rev=4321…
==============================================================================
--- trunk/gtk/src/ygdkmngloader.c (original)
+++ trunk/gtk/src/ygdkmngloader.c Thu Dec 20 21:36:55 2007
@@ -113,7 +113,8 @@
return ret;
is_file_mng_failed:
- fclose (file);
+ if (file)
+ fclose (file);
return FALSE;
}
Modified: trunk/gtk/src/ygtkratiobox.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.h?rev=43212…
==============================================================================
--- trunk/gtk/src/ygtkratiobox.h (original)
+++ trunk/gtk/src/ygtkratiobox.h Thu Dec 20 21:36:55 2007
@@ -96,8 +96,6 @@
gboolean *yfill, guint *padding,
gboolean *expandable);
-void ygtk_ratio_box_set_force_min_weight (YGtkRatioBox *box, gboolean force);
-
/* RatioHBox */
#define YGTK_TYPE_RATIO_HBOX (ygtk_ratio_hbox_get_type ())
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=43212&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Thu Dec 20 21:36:55 2007
@@ -312,7 +312,7 @@
wizard->m_title_image = gtk_image_new();
wizard->m_title_label = gtk_label_new("");
gtk_label_set_ellipsize (GTK_LABEL (wizard->m_title_label), PANGO_ELLIPSIZE_END);
- gtk_misc_set_alignment (GTK_MISC (wizard->m_title_label), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (wizard->m_title_label), 0, 0.5);
// setup label look
gtk_widget_modify_fg (wizard->m_title_label, GTK_STATE_NORMAL,
@@ -366,7 +366,7 @@
gtk_size_group_add_widget (buttons_group, wizard->m_abort_button);
g_object_unref (G_OBJECT (buttons_group));
- //** The menu and the navigation widget will be created when requested.
+ //** The menu and the navigation widgets will be created when requested.
//** Help dialog will be build on realize so we can give it a parent window.
}
@@ -413,8 +413,9 @@
DESTROY_WIDGET (wizard->m_title)
DESTROY_WIDGET (wizard->m_buttons)
DESTROY_WIDGET (wizard->m_menu)
- DESTROY_WIDGET (wizard->m_navigation)
+ DESTROY_WIDGET (wizard->m_steps)
DESTROY_WIDGET (wizard->m_title)
+ DESTROY_WIDGET (wizard->m_pane)
#undef DESTROY_WIDGET
if (wizard->m_help_dialog) {
@@ -445,56 +446,75 @@
void ygtk_wizard_enable_steps (YGtkWizard *wizard)
{
- if (wizard->m_navigation) {
- g_error ("YGtkWizard: a tree or steps widgets have already been enabled.");
- return;
- }
- wizard->m_navigation_widget = ygtk_steps_new();
- wizard->m_navigation = wizard->m_navigation_widget;
- gtk_widget_modify_text (wizard->m_navigation_widget, GTK_STATE_NORMAL,
- &wizard->m_navigation_widget->style->fg [GTK_STATE_SELECTED]);
+ g_return_if_fail (wizard->m_steps == NULL);
- gtk_widget_set_parent (wizard->m_navigation, GTK_WIDGET (wizard));
- gtk_widget_show_all (wizard->m_navigation);
+ wizard->m_steps = ygtk_steps_new();
+ gtk_widget_modify_text (wizard->m_steps, GTK_STATE_NORMAL,
+ &wizard->m_steps->style->fg [GTK_STATE_SELECTED]);
+
+ gtk_widget_set_parent (wizard->m_steps, GTK_WIDGET (wizard));
+ gtk_widget_show (wizard->m_steps);
+ gtk_widget_queue_resize (GTK_WIDGET (wizard));
}
void ygtk_wizard_enable_tree (YGtkWizard *wizard)
{
- if (wizard->m_navigation) {
- g_error ("YGtkWizard: a tree or steps widgets have already been enabled.");
- return;
- }
+ g_return_if_fail (wizard->m_tree == NULL);
- wizard->m_navigation_widget = gtk_tree_view_new_with_model
+ wizard->m_tree_view = gtk_tree_view_new_with_model
(GTK_TREE_MODEL (gtk_tree_store_new (1, G_TYPE_STRING)));
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (wizard->m_navigation_widget),
- 0, "(no title)", gtk_cell_renderer_text_new(), "text", 0, NULL);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (wizard->m_navigation_widget), FALSE);
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (wizard->m_tree_view),
+ 0, "", gtk_cell_renderer_text_new(), "text", 0, NULL);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (wizard->m_tree_view), FALSE);
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
- GTK_TREE_VIEW (wizard->m_navigation_widget)), GTK_SELECTION_BROWSE);
+ GTK_TREE_VIEW (wizard->m_tree_view)), GTK_SELECTION_BROWSE);
- g_signal_connect (G_OBJECT (wizard->m_navigation_widget), "cursor-changed",
+ g_signal_connect (G_OBJECT (wizard->m_tree_view), "cursor-changed",
G_CALLBACK (tree_item_selected_cb), wizard);
- wizard->m_navigation = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wizard->m_navigation),
+ wizard->m_tree = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wizard->m_tree),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (wizard->m_navigation),
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (wizard->m_tree),
GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (wizard->m_navigation), wizard->m_navigation_widget);
- gtk_widget_set_size_request (wizard->m_navigation, 180, -1);
+ gtk_container_add (GTK_CONTAINER (wizard->m_tree), wizard->m_tree_view);
+ gtk_widget_set_size_request (wizard->m_tree, 180, -1);
- gtk_widget_set_parent (wizard->m_navigation, GTK_WIDGET (wizard));
- gtk_widget_show_all (wizard->m_navigation);
- gtk_widget_queue_draw (GTK_WIDGET (wizard));
+ GtkWidget *child = wizard->m_child, *pane;
+ pane = gtk_hpaned_new();
+ gtk_paned_pack1 (GTK_PANED (pane), wizard->m_tree, TRUE, TRUE);
+ gtk_widget_show_all (pane);
+ ygtk_wizard_set_child (wizard, pane);
+ wizard->m_pane = pane;
+ if (child)
+ gtk_container_add (GTK_CONTAINER (wizard), child);
+}
+
+static void ygtk_wizard_add_child (GtkContainer *container, GtkWidget *child)
+{
+ YGtkWizard *wizard = YGTK_WIZARD (container);
+ wizard->m_child = child;
+ if (wizard->m_pane)
+ gtk_paned_pack2 (GTK_PANED (wizard->m_pane), child, TRUE, FALSE);
+ else
+ GTK_CONTAINER_CLASS (ygtk_wizard_parent_class)->add (container, child);
+}
+
+static void ygtk_wizard_remove_child (GtkContainer *container, GtkWidget *child)
+{
+ YGtkWizard *wizard = YGTK_WIZARD (container);
+ wizard->m_child = NULL;
+ if (wizard->m_pane)
+ gtk_container_remove (GTK_CONTAINER (wizard->m_pane), child);
+ else
+ GTK_CONTAINER_CLASS (ygtk_wizard_parent_class)->remove (container, child);
}
void ygtk_wizard_set_child (YGtkWizard *wizard, GtkWidget *new_child)
{
- GtkWidget *child = GTK_BIN (wizard)->child;
- if (child)
- gtk_container_remove (GTK_CONTAINER (wizard), child);
+ if (wizard->m_child)
+ gtk_container_remove (GTK_CONTAINER (wizard), wizard->m_child);
if (new_child)
gtk_container_add (GTK_CONTAINER (wizard), new_child);
}
@@ -520,7 +540,7 @@
const char *text, const char *id)
{
GtkTreeModel *model = gtk_tree_view_get_model
- (GTK_TREE_VIEW (wizard->m_navigation_widget));
+ (GTK_TREE_VIEW (wizard->m_tree_view));
GtkTreeIter iter;
if (!parent_id || !*parent_id)
@@ -552,7 +572,7 @@
void ygtk_wizard_clear_tree (YGtkWizard *wizard)
{
- GtkTreeView *tree = GTK_TREE_VIEW (wizard->m_navigation_widget);
+ GtkTreeView *tree = GTK_TREE_VIEW (wizard->m_tree_view);
gtk_tree_store_clear (GTK_TREE_STORE (gtk_tree_view_get_model (tree)));
yg_hash_table_remove_all (wizard->tree_ids);
}
@@ -563,17 +583,17 @@
if (path == NULL)
return FALSE;
- g_signal_handlers_block_by_func (wizard->m_navigation_widget,
+ g_signal_handlers_block_by_func (wizard->m_tree_view,
(gpointer) tree_item_selected_cb, wizard);
- GtkWidget *widget = wizard->m_navigation_widget;
+ GtkWidget *widget = wizard->m_tree_view;
gtk_tree_view_expand_to_path (GTK_TREE_VIEW (widget), path);
gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path,
NULL, FALSE);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget), path, NULL,
TRUE, 0.5, 0.5);
- g_signal_handlers_unblock_by_func (wizard->m_navigation_widget,
+ g_signal_handlers_unblock_by_func (wizard->m_tree_view,
(gpointer) tree_item_selected_cb, wizard);
return TRUE;
}
@@ -766,15 +786,15 @@
void ygtk_wizard_add_step_header (YGtkWizard *wizard, const char *text)
{
- g_return_if_fail (wizard->m_navigation_widget != NULL);
- ygtk_steps_append_heading (YGTK_STEPS (wizard->m_navigation_widget), text);
+ g_return_if_fail (wizard->m_steps != NULL);
+ ygtk_steps_append_heading (YGTK_STEPS (wizard->m_steps), text);
}
void ygtk_wizard_add_step (YGtkWizard *wizard, const char* text, const char *id)
{
guint step_nb;
- g_return_if_fail (wizard->m_navigation_widget != NULL);
- step_nb = ygtk_steps_append (YGTK_STEPS (wizard->m_navigation_widget), text);
+ g_return_if_fail (wizard->m_steps != NULL);
+ step_nb = ygtk_steps_append (YGTK_STEPS (wizard->m_steps), text);
g_hash_table_insert (wizard->steps_ids, g_strdup (id), GINT_TO_POINTER (step_nb));
}
@@ -783,14 +803,13 @@
gpointer step_nb = g_hash_table_lookup (wizard->steps_ids, id);
if (!step_nb)
return FALSE;
- ygtk_steps_set_current (YGTK_STEPS (wizard->m_navigation_widget),
- GPOINTER_TO_INT (step_nb));
+ ygtk_steps_set_current (YGTK_STEPS (wizard->m_steps), GPOINTER_TO_INT (step_nb));
return TRUE;
}
void ygtk_wizard_clear_steps (YGtkWizard *wizard)
{
- ygtk_steps_clear (YGTK_STEPS (wizard->m_navigation_widget));
+ ygtk_steps_clear (YGTK_STEPS (wizard->m_steps));
yg_hash_table_remove_all (wizard->steps_ids);
}
@@ -809,7 +828,7 @@
const gchar *ygtk_wizard_get_tree_selection (YGtkWizard *wizard)
{
GtkTreePath *path;
- gtk_tree_view_get_cursor (GTK_TREE_VIEW (wizard->m_navigation_widget),
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW (wizard->m_tree_view),
&path, NULL);
if (path == NULL)
return NULL;
@@ -825,7 +844,7 @@
void ygtk_wizard_set_sensitive (YGtkWizard *wizard, gboolean sensitive)
{
- // FIXME: check if this chains through
+ // TODO: check if this chains through
gtk_widget_set_sensitive (GTK_WIDGET (wizard), sensitive);
if (ygtk_wizard_is_next_button_protected (wizard))
@@ -862,8 +881,8 @@
{
GtkRequisition nav_req, child_req;
- if (wizard->m_navigation) {
- gtk_widget_size_request (wizard->m_navigation, &nav_req);
+ if (wizard->m_steps) {
+ gtk_widget_size_request (wizard->m_steps, &nav_req);
nav_req.width += content_padding * 2;
nav_req.height += content_padding * 2;
}
@@ -951,8 +970,8 @@
nav_area.x = child_area.x;
nav_area.y = child_area.y;
nav_area.height = child_area.height;
- if (wizard->m_navigation) {
- gtk_widget_get_child_requisition (wizard->m_navigation, &req);
+ if (wizard->m_steps) {
+ gtk_widget_get_child_requisition (wizard->m_steps, &req);
nav_area.width = req.width + content_padding*2;
child_area.x += nav_area.width;
@@ -981,9 +1000,9 @@
}
// navigation pane
- if (wizard->m_navigation) {
+ if (wizard->m_steps) {
apply_allocation_padding (&nav_area, content_padding);
- gtk_widget_size_allocate (wizard->m_navigation, &nav_area);
+ gtk_widget_size_allocate (wizard->m_steps, &nav_area);
}
// buttons
@@ -1025,10 +1044,10 @@
w -= content_padding*2;
y += wizard->m_title->allocation.height + header_padding*2 + content_padding;
h -= wizard->m_title->allocation.height + header_padding*2 + content_padding*2;
- if (wizard->m_navigation) {
- int navigation_w = wizard->m_navigation->allocation.width;
- x += navigation_w + content_padding;
- w -= navigation_w + content_padding;
+ if (wizard->m_steps) {
+ int steps_w = wizard->m_steps->allocation.width;
+ x += steps_w + content_padding;
+ w -= steps_w + content_padding;
}
gdk_cairo_set_source_color (cr, &widget->style->bg [GTK_STATE_NORMAL]);
@@ -1042,8 +1061,8 @@
if (wizard->m_menu)
gtk_container_propagate_expose (container, wizard->m_menu, event);
gtk_container_propagate_expose (container, wizard->m_title, event);
- if (wizard->m_navigation)
- gtk_container_propagate_expose (container, wizard->m_navigation, event);
+ if (wizard->m_steps)
+ gtk_container_propagate_expose (container, wizard->m_steps, event);
gtk_container_propagate_expose (container, wizard->m_buttons, event);
if (GTK_BIN (container)->child)
gtk_container_propagate_expose (container, GTK_BIN (container)->child, event);
@@ -1059,8 +1078,8 @@
(*callback) (wizard->m_buttons, callback_data);
if (wizard->m_menu)
(*callback) (wizard->m_menu, callback_data);
- if (wizard->m_navigation)
- (*callback) (wizard->m_navigation, callback_data);
+ if (wizard->m_steps)
+ (*callback) (wizard->m_steps, callback_data);
}
GtkWidget *containee = GTK_BIN (container)->child;
@@ -1068,150 +1087,6 @@
(*callback) (containee, callback_data);
}
-/* Accessibility support */
-
-static gint ygtk_wizard_accessible_get_n_children (AtkObject *accessible)
-{
- return 1 /* content*/ + 5 /* buttons*/;
-}
-
-static AtkObject *ygtk_wizard_accessible_ref_child (AtkObject *accessible,
- gint index)
-{
- GtkWidget *widget = GTK_ACCESSIBLE (accessible)->widget;
- if (!widget)
- return NULL;
- YGtkWizard *wizard = YGTK_WIZARD (widget);
-
- if (index == 0) {
- GtkWidget *child = GTK_BIN (wizard)->child;
- if (child)
- return g_object_ref (G_OBJECT (child));
- return NULL;
- }
-
- if (index >= 1 && index <= 5) {
- GtkWidget *buttons[5] = { wizard->m_back_button, wizard->m_abort_button,
- wizard->m_next_button, wizard->m_help_button,
- wizard->m_release_notes_button };
- GtkWidget *button = buttons [index-1];
-
- if (GTK_WIDGET_VISIBLE (button))
- return g_object_ref (G_OBJECT (button));
- return NULL;
- }
- // out of range
- return NULL;
-}
-
-static void ygtk_wizard_accessible_class_init (AtkObjectClass *class)
-{
- class->get_n_children = ygtk_wizard_accessible_get_n_children;
- class->ref_child = ygtk_wizard_accessible_ref_child;
-}
-
-static GType ygtk_wizard_accessible_get_type (void)
-{
- static GType type = 0;
- if (!type) {
- AtkObjectFactory *factory;
- GType derived_type;
- GTypeQuery query;
- GType derived_atk_type;
-
- derived_type = g_type_parent (YGTK_TYPE_WIZARD);
- factory = atk_registry_get_factory (atk_get_default_registry (), derived_type);
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- g_type_query (derived_atk_type, &query);
-
- GTypeInfo type_info = { 0 };
- type_info.class_size = query.class_size;
- type_info.class_init = (GClassInitFunc) ygtk_wizard_accessible_class_init;
- type_info.instance_size = query.instance_size;
-
- type = g_type_register_static (derived_atk_type, "YGtkWizardAccessible",
- &type_info, 0);
-
-/*
- type = g_type_register_static_simple (derived_atk_type,
- "YGtkWizardAccessible", query.class_size,
- (GClassInitFunc) ygtk_wizard_accessible_class_init,
- query.instance_size, NULL, 0);
-*/
- }
- return type;
-}
-
-static AtkObject *ygtk_wizard_accessible_new (GObject *obj)
-{
- AtkObject *accessible;
- g_return_val_if_fail (YGTK_IS_WIZARD (obj), NULL);
-
- accessible = g_object_new (ygtk_wizard_accessible_get_type (), NULL);
- atk_object_initialize (accessible, obj);
- return accessible;
-}
-
-static GType ygtk_wizard_accessible_factory_get_accessible_type()
-{
- return ygtk_wizard_accessible_get_type ();
-}
-
-static AtkObject*ygtk_wizard_accessible_factory_create_accessible (GObject *obj)
-{
- return ygtk_wizard_accessible_new (obj);
-}
-
-static void ygtk_wizard_accessible_factory_class_init (AtkObjectFactoryClass *class)
-{
- class->create_accessible = ygtk_wizard_accessible_factory_create_accessible;
- class->get_accessible_type = ygtk_wizard_accessible_factory_get_accessible_type;
-}
-
-static GType ygtk_wizard_accessible_factory_get_type (void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo type_info = { 0 };
- type_info.class_size = sizeof (AtkObjectFactoryClass);
- type_info.class_init = (GClassInitFunc) ygtk_wizard_accessible_factory_class_init;
- type_info.instance_size = sizeof (AtkObjectFactory);
-
- type = g_type_register_static (ATK_TYPE_OBJECT_FACTORY,
- "YGtkWizardAccessibleFactory", &type_info, 0);
-
-/*
- type = g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY,
- "YGtkWizardAccessibleFactory", sizeof (AtkObjectFactoryClass),
- (GClassInitFunc) ygtk_wizard_accessible_factory_class_init,
- sizeof (AtkObjectFactory), NULL, 0);
-*/
- }
- return type;
-}
-
-static AtkObject *ygtk_wizard_get_accessible (GtkWidget *widget)
-{
- static gboolean first_time = TRUE;
- if (first_time) {
- AtkObjectFactory *factory;
- AtkRegistry *registry;
- GType derived_type;
- GType derived_atk_type;
-
- derived_type = g_type_parent (YGTK_TYPE_WIZARD);
- registry = atk_get_default_registry ();
- factory = atk_registry_get_factory (registry, derived_type);
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE)) {
- atk_registry_set_factory_type (registry, YGTK_TYPE_WIZARD,
- ygtk_wizard_accessible_factory_get_type ());
- }
- first_time = FALSE;
- }
- return GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->get_accessible (widget);
-}
-
static void ygtk_wizard_class_init (YGtkWizardClass *klass)
{
ygtk_wizard_parent_class = g_type_class_peek_parent (klass);
@@ -1222,10 +1097,11 @@
widget_class->realize = ygtk_wizard_realize;
widget_class->size_request = ygtk_wizard_size_request;
widget_class->size_allocate = ygtk_wizard_size_allocate;
- widget_class->get_accessible = ygtk_wizard_get_accessible;
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
container_class->forall = ygtk_wizard_forall;
+ container_class->add = ygtk_wizard_add_child;
+ container_class->remove = ygtk_wizard_remove_child;
GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
gtkobject_class->destroy = ygtk_wizard_destroy;
Modified: trunk/gtk/src/ygtkwizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.h?rev=43212&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.h (original)
+++ trunk/gtk/src/ygtkwizard.h Thu Dec 20 21:36:55 2007
@@ -81,11 +81,12 @@
GHashTable *steps_ids; /* gchar* -> guint */
/* Widgets for layout. */
- GtkWidget *m_menu, *m_title, *m_navigation, *m_buttons;
+ GtkWidget *m_menu, *m_title, *m_steps, *m_tree, *m_buttons;
+ GtkWidget *m_child, *m_pane;
// containee can be accessed via GTK_BIN (wizard)->child
/* Widgets we need to have access to. */
- GtkWidget *m_title_label, *m_title_image, *m_navigation_widget,
+ GtkWidget *m_title_label, *m_title_image, *m_tree_view,
*m_back_button, *m_abort_button, *m_next_button, *m_help_button,
*m_release_notes_button;
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
Author: rpmcruz
Date: Thu Dec 20 21:36:18 2007
New Revision: 43211
URL: http://svn.opensuse.org/viewcvs/yast?rev=43211&view=rev
Log:
Moving unstable-libyui to main.
Added:
trunk/gtk/src/icons/
trunk/gtk/src/icons/cat-development.xpm
trunk/gtk/src/icons/cat-documentation.xpm
trunk/gtk/src/icons/cat-emulators.xpm
trunk/gtk/src/icons/cat-games.xpm
trunk/gtk/src/icons/cat-hardware.xpm
trunk/gtk/src/icons/cat-multimedia.xpm
trunk/gtk/src/icons/cat-network.xpm
trunk/gtk/src/icons/cat-office.xpm
trunk/gtk/src/icons/cat-system.xpm
trunk/gtk/src/icons/cat-utilities.xpm
trunk/gtk/src/icons/pkg-3D.xpm
trunk/gtk/src/icons/pkg-available-locked.xpm
trunk/gtk/src/icons/pkg-available.xpm
trunk/gtk/src/icons/pkg-install-auto.xpm
trunk/gtk/src/icons/pkg-install.xpm
trunk/gtk/src/icons/pkg-installed-locked.xpm
trunk/gtk/src/icons/pkg-installed-upgradable-locked.xpm
trunk/gtk/src/icons/pkg-installed-upgradable.xpm
trunk/gtk/src/icons/pkg-installed.xpm
trunk/gtk/src/icons/pkg-list-mode.xpm
trunk/gtk/src/icons/pkg-locked.xpm
trunk/gtk/src/icons/pkg-remove-auto.xpm
trunk/gtk/src/icons/pkg-remove.xpm
trunk/gtk/src/icons/pkg-tiles-mode.xpm
trunk/gtk/src/icons/pkg-unlocked.xpm
Added: trunk/gtk/src/icons/cat-development.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-development.xp…
==============================================================================
--- trunk/gtk/src/icons/cat-development.xpm (added)
+++ trunk/gtk/src/icons/cat-development.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,328 @@
+/* XPM */
+static const char * cat_development_xpm[] = {
+"22 22 303 2",
+" c None",
+". c #C4A61B",
+"+ c #C4A419",
+"@ c #C5A30C",
+"# c #C6A40C",
+"$ c #C7A610",
+"% c #C5A30B",
+"& c #C4A414",
+"* c #C4A71E",
+"= c #C4A417",
+"- c #F7F2E1",
+"; c #F3EDD4",
+"> c #F9F5DB",
+", c #FBFAE7",
+"' c #FAF7E9",
+") c #F9F7EC",
+"! c #EFE7C1",
+"~ c #C5A40C",
+"{ c #C6A406",
+"] c #D9C257",
+"^ c #F9F5E5",
+"/ c #F8EFA2",
+"( c #FAF1A4",
+"_ c #FAF1A2",
+": c #F9F09E",
+"< c #F3EAA1",
+"[ c #E7D779",
+"} c #DDCA72",
+"| c #C6A408",
+"1 c #C8A70D",
+"2 c #D0B333",
+"3 c #EDE1A5",
+"4 c #FDFBE9",
+"5 c #FBF3B0",
+"6 c #FCF4B1",
+"7 c #FDF5B1",
+"8 c #FCF4AC",
+"9 c #FBF2A2",
+"0 c #E9DA7F",
+"a c #F4EDC2",
+"b c #EFE5B8",
+"c c #C5A205",
+"d c #C7A60A",
+"e c #C7A407",
+"f c #F9F4CF",
+"g c #FCF8D9",
+"h c #FDFBE7",
+"i c #FBF4B9",
+"j c #FCF4B6",
+"k c #FCF4B4",
+"l c #FCF4AD",
+"m c #FAF2A4",
+"n c #E8D875",
+"o c #F3E887",
+"p c #F8F0B2",
+"q c #F7F1CF",
+"r c #D6BE52",
+"s c #C6A308",
+"t c #F7F1C8",
+"u c #F9F3C3",
+"v c #F8F1B4",
+"w c #FBF7D5",
+"x c #FBF5C4",
+"y c #FAF3B5",
+"z c #F9F2AF",
+"A c #F9F0A8",
+"B c #F8EF9F",
+"C c #E7D673",
+"D c #F5EA8A",
+"E c #F7EFA7",
+"F c #FAF6D2",
+"G c #EADD9C",
+"H c #C7A40A",
+"I c #C7A408",
+"J c #E9DC9B",
+"K c #F6F0B8",
+"L c #F5EDA5",
+"M c #F7F0B0",
+"N c #F9F3C2",
+"O c #FAF4C3",
+"P c #F8F0AF",
+"Q c #F7EFA8",
+"R c #F7EDA0",
+"S c #F5EB96",
+"T c #EBDC79",
+"U c #F3E782",
+"V c #F8F0B3",
+"W c #F5EB9F",
+"X c #F5EDAD",
+"Y c #E2D082",
+"Z c #C5A202",
+"` c #C4A20E",
+" . c #D7C054",
+".. c #F6F0C3",
+"+. c #F1E790",
+"@. c #F3EA9B",
+"#. c #F4ECA4",
+"$. c #F5EDA8",
+"%. c #F6EFB1",
+"&. c #F5ECA3",
+"*. c #F5EB9D",
+"=. c #F4EA95",
+"-. c #F0E588",
+";. c #F0E37F",
+">. c #F0E379",
+",. c #F5EEAB",
+"'. c #EDDF6C",
+"). c #E9D952",
+"!. c #EFE6AA",
+"~. c #C7A409",
+"{. c #C4A208",
+"]. c #E2D183",
+"^. c #F1E89F",
+"/. c #EEE383",
+"(. c #F0E58B",
+"_. c #F1E792",
+":. c #F2E896",
+"<. c #F2E892",
+"[. c #F1E68D",
+"}. c #F1E586",
+"|. c #EEE07B",
+"1. c #EEE174",
+"2. c #EDE070",
+"3. c #EEE37E",
+"4. c #E8D852",
+"5. c #E5D33E",
+"6. c #F0E79E",
+"7. c #D7BE53",
+"8. c #C5A30A",
+"9. c #F4EFD0",
+"0. c #E8DA68",
+"a. c #EADD71",
+"b. c #ECDF79",
+"c. c #EDE17E",
+"d. c #EEE281",
+"e. c #EEE27F",
+"f. c #EDE17B",
+"g. c #ECE074",
+"h. c #EBDC6B",
+"i. c #EADB64",
+"j. c #E8D856",
+"k. c #E5D447",
+"l. c #E1CF30",
+"m. c #E0CC2A",
+"n. c #E8DA66",
+"o. c #E9DEA8",
+"p. c #C4A209",
+"q. c #F6F2D1",
+"r. c #E5D555",
+"s. c #E6D75D",
+"t. c #E8D964",
+"u. c #E6D658",
+"v. c #E6D654",
+"w. c #E3D243",
+"x. c #E3D343",
+"y. c #E4D243",
+"z. c #E3D140",
+"A. c #E3D03B",
+"B. c #DFCC2A",
+"C. c #DECA26",
+"D. c #DECA24",
+"E. c #DDC921",
+"F. c #DCC81E",
+"G. c #DBC61A",
+"H. c #EDE29E",
+"I. c #C4A30A",
+"J. c #C5A308",
+"K. c #F5F0C9",
+"L. c #DCC92A",
+"M. c #DDC929",
+"N. c #DBC519",
+"O. c #DAC517",
+"P. c #ECE183",
+"Q. c #E9DB6E",
+"R. c #E6D860",
+"S. c #E5D452",
+"T. c #E2D143",
+"U. c #DFCD33",
+"V. c #DCC823",
+"W. c #C5B112",
+"X. c #D9C414",
+"Y. c #D8C311",
+"Z. c #D7C20E",
+"`. c #F4EFC3",
+" + c #C5A40D",
+".+ c #F9F6E1",
+"++ c #D4BD04",
+"@+ c #D5BE05",
+"#+ c #D5BF08",
+"$+ c #D6C00A",
+"%+ c #E2D14A",
+"&+ c #D7C10D",
+"*+ c #D7C10E",
+"=+ c #D7C10C",
+"-+ c #BFAB08",
+";+ c #D6C009",
+">+ c #D5BF07",
+",+ c #D4BE05",
+"'+ c #F3EDBD",
+")+ c #C19F04",
+"!+ c #C3A20A",
+"~+ c #EEE5A9",
+"{+ c #E7DA72",
+"]+ c #D3BC01",
+"^+ c #D3BC00",
+"/+ c #DDCB38",
+"(+ c #BEA900",
+"_+ c #D4BE07",
+":+ c #DFCE43",
+"<+ c #F2EBBD",
+"[+ c #BA9900",
+"}+ c #C9B142",
+"|+ c #E6D791",
+"1+ c #F1E8A6",
+"2+ c #E4D55D",
+"3+ c #DBC92E",
+"4+ c #BFAA00",
+"5+ c #D6C00F",
+"6+ c #E2D355",
+"7+ c #E3D45B",
+"8+ c #EFE6BB",
+"9+ c #A58700",
+"0+ c #967C08",
+"a+ c #D8C360",
+"b+ c #E1D356",
+"c+ c #E7DA6D",
+"d+ c #DECD40",
+"e+ c #DBC82D",
+"f+ c #DAC82B",
+"g+ c #C7B313",
+"h+ c #E1D04B",
+"i+ c #E6D86B",
+"j+ c #E5D867",
+"k+ c #F8F4D8",
+"l+ c #EADEAA",
+"m+ c #CCB337",
+"n+ c #F1E9B9",
+"o+ c #E0D04A",
+"p+ c #E0CF46",
+"q+ c #E1D14E",
+"r+ c #E2D356",
+"s+ c #E1D24F",
+"t+ c #E0CF48",
+"u+ c #E4D55F",
+"v+ c #E8DC76",
+"w+ c #E9DC78",
+"x+ c #E8DC77",
+"y+ c #E8DB73",
+"z+ c #F3ECB7",
+"A+ c #F4EFD3",
+"B+ c #C29F05",
+"C+ c #AE9006",
+"D+ c #D8C25F",
+"E+ c #F2ECBB",
+"F+ c #E9DE7F",
+"G+ c #E2D252",
+"H+ c #E3D45A",
+"I+ c #E5D662",
+"J+ c #E6D86A",
+"K+ c #E7DA71",
+"L+ c #E9DD7D",
+"M+ c #EADE80",
+"N+ c #EADF81",
+"O+ c #EADE7F",
+"P+ c #F7F3D1",
+"Q+ c #F7F3D9",
+"R+ c #D6BD4E",
+"S+ c #886F00",
+"T+ c #B99905",
+"U+ c #D5BC4D",
+"V+ c #F2EBC2",
+"W+ c #F4EEC4",
+"X+ c #ECE18D",
+"Y+ c #E5D765",
+"Z+ c #E7D96D",
+"`+ c #E8DB75",
+" @ c #EBE084",
+".@ c #F0E9AB",
+"+@ c #F8F4D6",
+"@@ c #F9F7E2",
+"#@ c #EEE4B7",
+"$@ c #D6BC4D",
+"%@ c #B09001",
+"&@ c #A58800",
+"*@ c #C19F06",
+"=@ c #E0D085",
+"-@ c #EADFAD",
+";@ c #F2ECCE",
+">@ c #F5F0D7",
+",@ c #F7F3DC",
+"'@ c #F7F3DD",
+")@ c #F4F0D6",
+"!@ c #F2ECCF",
+"~@ c #E3D38B",
+"{@ c #D5BE51",
+"]@ c #C2A006",
+"^@ c #A1860A",
+"/@ c #A78A08",
+"(@ c #AA8C08",
+"_@ c #AC8E08",
+":@ c #B09108",
+"<@ c #9C8109",
+"[@ c #9D830A",
+" . + @ # $ % & * . ",
+" = - ; > , ' ) ! ~ ",
+" { ] ^ / ( _ : < [ } | ",
+" 1 2 3 4 5 6 7 8 9 0 a b c d ",
+" e c f g h i j k l m n o p q r ",
+" s t u v w x y z A B C D E F G H ",
+" I J K L M N O P Q R S T U V W X Y Z ",
+" ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~. ",
+" {.].^./.(._.:.:.<.[.}.|.1.2.3.4.5.6.7.` ",
+" 8.9.0.a.b.c.d.d.e.f.g.h.i.j.k.l.m.n.o.p. ",
+" 8.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I. ",
+" J.K.L.M.N.O.P.Q.R.S.T.U.V.W.O.X.Y.Z.`.{. ",
+" +.+++@+#+$+%+&+*+*+*+&+=+-+;+>+,+#+'+)+ ",
+" !+~+{+]+^+^+/+^+^+^+^+^+^+(+^+^+_+:+<+[+ ",
+" }+|+1+2+_+^+3+^+^+^+^+^+^+4+^+5+6+7+8+9+ ",
+" 0+a+b+c+d+e+f+^+^+^+^+^+^+g+h+i+j+k+l+ ",
+" m+n+o+p+q+r+r+s+o+t+u+v+w+x+y+z+A+B+ ",
+" C+D+E+F+G+H+I+J+K+x+L+M+N+O+P+Q+R+S+ ",
+" T+U+V+W+X+Y+Z+`+L+ @.@+@@@#@$@%@ ",
+" &@*@=@-@;@>@,@'@)@!@~@{@]@ ",
+" ^@/@(@_@:@/@<@[@ ",
+" "};
Added: trunk/gtk/src/icons/cat-documentation.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-documentation.…
==============================================================================
--- trunk/gtk/src/icons/cat-documentation.xpm (added)
+++ trunk/gtk/src/icons/cat-documentation.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,257 @@
+/* XPM */
+static const char * cat_documentation_xpm[] = {
+"22 22 232 2",
+" c None",
+". c #204A87",
+"+ c #4C6E9F",
+"@ c #879DBE",
+"# c #B3C1D6",
+"$ c #E0E6EE",
+"% c #B4C2D7",
+"& c #879EBE",
+"* c #4C6E9E",
+"= c #29518B",
+"- c #A0B2CC",
+"; c #E6EBF1",
+"> c #A4B5CE",
+", c #7893B7",
+"' c #4E71A1",
+") c #5072A3",
+"! c #7D96BB",
+"~ c #A9BAD2",
+"{ c #E9EDF3",
+"] c #A1B3CD",
+"^ c #29518C",
+"/ c #4A6C9E",
+"( c #DFE5EE",
+"_ c #A9B9D1",
+": c #355C94",
+"< c #2F5791",
+"[ c #335B94",
+"} c #365E96",
+"| c #386098",
+"1 c #396199",
+"2 c #3A6299",
+"3 c #466B9F",
+"4 c #B5C4D9",
+"5 c #4D6EA0",
+"6 c #29528C",
+"7 c #6C88B0",
+"8 c #2D5690",
+"9 c #6281AD",
+"0 c #B5C4D8",
+"a c #E3E8F0",
+"b c #F8F9FB",
+"c c #F3F5F8",
+"d c #DAE2EC",
+"e c #92A9C7",
+"f c #446B9F",
+"g c #41699E",
+"h c #829CBF",
+"i c #E0E6EF",
+"j c #A3B4CD",
+"k c #A8B9D0",
+"l c #345C95",
+"m c #FFFFFF",
+"n c #A9BCD4",
+"o c #4B71A5",
+"p c #486FA3",
+"q c #BAC8DB",
+"r c #A6B8D0",
+"s c #214B87",
+"t c #5071A0",
+"u c #E5EAF1",
+"v c #375E95",
+"w c #345D95",
+"x c #3B639A",
+"y c #A8BAD2",
+"z c #B8C7DB",
+"A c #7B97BD",
+"B c #6688B3",
+"C c #A6BAD4",
+"D c #ECF0F5",
+"E c #547AAC",
+"F c #5177A9",
+"G c #587CAB",
+"H c #5273A2",
+"I c #8CA2C1",
+"J c #42699F",
+"K c #4B72A5",
+"L c #5076A8",
+"M c #557BAC",
+"N c #5A7FB0",
+"O c #6B8DB8",
+"P c #F0F3F7",
+"Q c #5E83B2",
+"R c #5A7FAF",
+"S c #B6C6DB",
+"T c #90A7C5",
+"U c #BAC7DA",
+"V c #7691B6",
+"W c #386097",
+"X c #40679D",
+"Y c #577CAD",
+"Z c #5D82B2",
+"` c #6488B6",
+" . c #CED9E8",
+".. c #C2D1E3",
+"+. c #678BB9",
+"@. c #6287B5",
+"#. c #96ADCB",
+"$. c #BDCBDD",
+"%. c #224C88",
+"&. c #E7ECF2",
+"*. c #4E71A2",
+"=. c #3C649A",
+"-. c #456CA1",
+";. c #4D74A7",
+">. c #6489B7",
+",. c #CBD7E7",
+"'. c #E1E8F1",
+"). c #7799C3",
+"!. c #7093BF",
+"~. c #6B8EBB",
+"{. c #7796BE",
+"]. c #E6EBF2",
+"^. c #E8EDF3",
+"/. c #5074A4",
+"(. c #496FA3",
+"_. c #5278AA",
+":. c #5A80B0",
+"<. c #6387B6",
+"[. c #B2C5DB",
+"}. c #E0E8F2",
+"|. c #83A4CB",
+"1. c #7C9FC8",
+"2. c #789BC5",
+"3. c #7295C0",
+"4. c #6B8FBB",
+"5. c #7C9AC2",
+"6. c #E7ECF3",
+"7. c #224B88",
+"8. c #BECBDD",
+"9. c #7C96BB",
+"0. c #4C72A5",
+"a. c #5E83B3",
+"b. c #E1E9F1",
+"c. c #9EB9D8",
+"d. c #88A9D0",
+"e. c #85A7CE",
+"f. c #80A2CA",
+"g. c #9FB6D3",
+"h. c #C1CEDF",
+"i. c #234D89",
+"j. c #94A8C5",
+"k. c #A6B8D1",
+"l. c #446BA0",
+"m. c #4E74A7",
+"n. c #577DAE",
+"o. c #6185B4",
+"p. c #6A8EBB",
+"q. c #81A2C9",
+"r. c #89AACF",
+"s. c #8EAFD4",
+"t. c #91B2D6",
+"u. c #8DAFD4",
+"v. c #86A7CE",
+"w. c #7D9FC8",
+"x. c #7397C1",
+"y. c #C1D0E2",
+"z. c #97ACC9",
+"A. c #5879A6",
+"B. c #4C71A4",
+"C. c #587DAE",
+"D. c #6286B5",
+"E. c #6B8FBC",
+"F. c #D3DEEB",
+"G. c #E7EDF5",
+"H. c #E9EFF6",
+"I. c #9FBCDC",
+"J. c #9BBBDD",
+"K. c #92B3D7",
+"L. c #88AAD0",
+"M. c #7EA1C9",
+"N. c #7C9DC5",
+"O. c #EEF2F7",
+"P. c #5575A4",
+"Q. c #AFBFD5",
+"R. c #AFC0D6",
+"S. c #6186B4",
+"T. c #E9EFF5",
+"U. c #9FBBDA",
+"V. c #86A8CE",
+"W. c #C8D6E7",
+"X. c #B2C2D8",
+"Y. c #2E568F",
+"Z. c #809BC0",
+"`. c #5F83B3",
+" + c #688CB9",
+".+ c #E9EEF5",
+"++ c #98B5D6",
+"@+ c #89AAD0",
+"#+ c #86A8CF",
+"$+ c #80A3CA",
+"%+ c #A4BBD7",
+"&+ c #E9EEF4",
+"*+ c #2C538D",
+"=+ c #5878A6",
+"-+ c #B5C5DB",
+";+ c #6285B3",
+">+ c #6388B6",
+",+ c #7396C1",
+"'+ c #799CC5",
+")+ c #7DA0C8",
+"!+ c #7FA1C9",
+"~+ c #83A4CA",
+"{+ c #C9D7E7",
+"]+ c #EAEFF5",
+"^+ c #5576A5",
+"/+ c #214B88",
+"(+ c #B4C4D9",
+"_+ c #B7C7DC",
+":+ c #99B1CF",
+"<+ c #7E9DC4",
+"[+ c #83A2C7",
+"}+ c #A3BAD7",
+"|+ c #C1D1E4",
+"1+ c #B5C5DA",
+"2+ c #2C558E",
+"3+ c #214A86",
+"4+ c #5C7CA8",
+"5+ c #9CB0CC",
+"6+ c #C8D3E3",
+"7+ c #EDF1F6",
+"8+ c #C9D4E4",
+"9+ c #9DB1CC",
+"0+ c #5978A5",
+"a+ c #224982",
+"b+ c #132C51",
+"c+ c #193866",
+"d+ c #20457A",
+"e+ c #204985",
+"f+ c #214982",
+"g+ c #1E4173",
+"h+ c #15325A",
+"i+ c #0F2341",
+" ",
+" . . . . . . . . ",
+" . . + @ # $ $ % & * . ",
+" . = - ; > , ' ) ! ~ { ] ^ . ",
+" . / ( _ : < [ } | 1 2 3 4 $ 5 . ",
+" . 6 $ 7 8 9 0 a b c d e f g h i ^ ",
+" . j k 8 l ~ m m m m m m n o p q r s ",
+" . t u v w x y z A B C m m D E F G D H ",
+" . I - [ 2 J K L M N O m m P Q R M S T . ",
+" . U V W X p L Y Z ` .m m ..+.@.Z #.$.%. ",
+" . &.*.=.-.;.M Z >.,.m m '.).!.~.>.{.].s ",
+" . ^./.X (._.:.<.[.m m }.|.1.2.3.4.5.6.7. ",
+" . 8.9.J 0.M a.+.b.m m c.d.e.f.2.!.g.h.i. ",
+" . j.k.l.m.n.o.p.).q.r.s.t.u.v.w.x.y.z.. ",
+" . A.].B.m.C.D.E.F.G.H.I.J.K.L.M.N.O.P. ",
+" . Q.R.m.n.S.p.T.m m U.K.s.V.w.W.X.i. ",
+" Y.&.Z.M `. +.+m m ++@+#+$+%+&+*+ ",
+" s =+6.-+;+>+E.,+'+)+!+~+{+]+^+ ",
+" /+Y.(+&+_+:+<+[+}+|+O.1+2+ ",
+" 3+4+5+6+7+7+8+9+0+a+ ",
+" b+c+d+e+f+g+h+i+ ",
+" "};
Added: trunk/gtk/src/icons/cat-emulators.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-emulators.xpm?…
==============================================================================
--- trunk/gtk/src/icons/cat-emulators.xpm (added)
+++ trunk/gtk/src/icons/cat-emulators.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,193 @@
+/* XPM */
+static const char * cat_emulators_xpm[] = {
+"22 22 168 2",
+" c None",
+". c #888A85",
+"+ c #F7F8F7",
+"@ c #70726D",
+"# c #F9F9F8",
+"$ c #ECEEEB",
+"% c #E6E8E4",
+"& c #DFE1DD",
+"* c #DDDFDB",
+"= c #D8D9D5",
+"- c #D1D4CF",
+"; c #D5D8D3",
+"> c #E6E7E5",
+", c #ECEDEA",
+"' c #446EA0",
+") c #204A87",
+"! c #426D9F",
+"~ c #CDCFCA",
+"{ c #6A7583",
+"] c #6B7888",
+"^ c #6C798D",
+"/ c #6E7D90",
+"( c #989F92",
+"_ c #6F7F95",
+": c #6F7F96",
+"< c #6E7D92",
+"[ c #6E7C8F",
+"} c #6C7A8D",
+"| c #C1C4BE",
+"1 c #6C798B",
+"2 c #6F7E95",
+"3 c #99A297",
+"4 c #B8BB97",
+"5 c #9BA39A",
+"6 c #72859E",
+"7 c #72849E",
+"8 c #72849D",
+"9 c #70839B",
+"0 c #6F8099",
+"a c #6E7E95",
+"b c #B7BAB4",
+"c c #6F7E93",
+"d c #708098",
+"e c #70839D",
+"f c #CDCC97",
+"g c #FEFADE",
+"h c #B9BE9B",
+"i c #738AA6",
+"j c #748AA6",
+"k c #7389A5",
+"l c #7388A3",
+"m c #72879F",
+"n c #495E7B",
+"o c #72859F",
+"p c #9CA79E",
+"q c #E5DF96",
+"r c #FFFFFF",
+"s c #DCD998",
+"t c #778FAD",
+"u c #7790AD",
+"v c #9EADA5",
+"w c #758EAC",
+"x c #738BA7",
+"y c #536F91",
+"z c #2B4A73",
+"A c #193963",
+"B c #4D6487",
+"C c #5F7798",
+"D c #CACB94",
+"E c #FEFADD",
+"F c #ECE596",
+"G c #9AABA3",
+"H c #90A49C",
+"I c #A8B389",
+"J c #778D84",
+"K c #234E7F",
+"L c #214979",
+"M c #1D4573",
+"N c #1D3F6C",
+"O c #1D416E",
+"P c #1F4776",
+"Q c #B0B25E",
+"R c #C8C45C",
+"S c #FEF8CA",
+"T c #92A26D",
+"U c #C8C55E",
+"V c #B2B663",
+"W c #658176",
+"X c #637F73",
+"Y c #637A6F",
+"Z c #60776A",
+"` c #B4BAAE",
+" . c #C6C158",
+".. c #C7C25A",
+"+. c #E2D756",
+"@. c #93A26E",
+"#. c #B4B966",
+"$. c #FDF3A5",
+"%. c #D8D15B",
+"&. c #B3B764",
+"*. c #B1B461",
+"=. c #424904",
+"-. c #B3B965",
+";. c #6A8A80",
+">. c #CAC961",
+",. c #6C8D84",
+"'. c #444D11",
+"). c #C7C35B",
+"!. c #C8C55D",
+"~. c #C9C75E",
+"{. c #6A8A81",
+"]. c #6C8D85",
+"^. c #B6BD6A",
+"/. c #CBCB63",
+"(. c #336FA2",
+"_. c #B5BC69",
+":. c #B3BA67",
+"<. c #B3B765",
+"[. c #B2B563",
+"}. c #B6B9B3",
+"|. c #919E69",
+"1. c #94A571",
+"2. c #2F669A",
+"3. c #316CA0",
+"4. c #99AD79",
+"5. c #9AAF7B",
+"6. c #3775A7",
+"7. c #3571A5",
+"8. c #316BA0",
+"9. c #2B6094",
+"0. c #27598C",
+"a. c #255588",
+"b. c #295C8F",
+"c. c #2D6397",
+"d. c #316B9E",
+"e. c #336FA3",
+"f. c #71978E",
+"g. c #749C92",
+"h. c #3B79AD",
+"i. c #3775A8",
+"j. c #356FA3",
+"k. c #2F699D",
+"l. c #2D6396",
+"m. c #295C8E",
+"n. c #275588",
+"o. c #295E91",
+"p. c #2F6498",
+"q. c #3572A5",
+"r. c #3B78AC",
+"s. c #9DB37F",
+"t. c #3F81B5",
+"u. c #3B7DB1",
+"v. c #3978AB",
+"w. c #336B9F",
+"x. c #2D6398",
+"y. c #295A8F",
+"z. c #C0C3BD",
+"A. c #EBEDEA",
+"B. c #C4C7C1",
+"C. c #F7F8F6",
+"D. c #E2E4E0",
+"E. c #D4D7D2",
+"F. c #C8CBC5",
+"G. c #C2C4BF",
+"H. c #BCBFB9",
+"I. c #C2C5BF",
+"J. c #C6C9C3",
+"K. c #6C6E69",
+" . . . . . . . . . . . . . . . . . . ",
+" . + + + + + + + + + + + + + + + + + + @ ",
+". + # $ % & & & & & & & & & * = - - ; > + . ",
+". + , ' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ! ~ + . ",
+". + % ) { ] ^ / ( _ : : : _ < [ } ] ) | + . ",
+". + & ) 1 / 2 3 4 5 6 6 7 8 9 0 a / ) b + . ",
+". + & ) c d e f g h i j i k l m e n ) b + . ",
+". + & ) 9 o p q r s t u v w x y z A ) b + . ",
+". + & ) B C D E F E G H I J K L M N ) b + . ",
+". + & ) O P Q r R S T U r V W X Y Z ) ` + . ",
+". + & ) ...r +.@.S #.$.%.r &.V *.Q ) ` + . ",
+". + & =.r r r -.;.S >.r ,.S r r r r ) ` + . ",
+". + & '.).!.~.{.].^.r /.(.^._.:.<.[.) }.+ . ",
+". + & ) |.T 1.2.3.4.r 5.6.7.8.2.9.0.) }.+ . ",
+". + & ) a.b.c.d.e.f.$.g.h.i.j.k.l.m.) }.+ . ",
+". + % ) n.o.p.8.q.r.s.t.u.v.7.w.x.y.) z.+ . ",
+". + A.' ) ) ) ) ) ) ) ) ) ) ) ) ) ) ' B.+ . ",
+". + C.D.E.F.G.H.H.H.H.H.H.H.H.H.H.I.B.J.+ . ",
+" . + + + + + + + + + + + + + + + + + + K. ",
+" . . . . . . . . . . . . . . . . . . ",
+" ",
+" "};
Added: trunk/gtk/src/icons/cat-games.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-games.xpm?rev=…
==============================================================================
--- trunk/gtk/src/icons/cat-games.xpm (added)
+++ trunk/gtk/src/icons/cat-games.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,166 @@
+/* XPM */
+static const char * cat_games_xpm[] = {
+"22 22 141 2",
+" c None",
+". c #898B86",
+"+ c #8C8E8A",
+"@ c #8D8F8B",
+"# c #9B9C99",
+"$ c #BFC0BE",
+"% c #D5D6D4",
+"& c #959792",
+"* c #8C8E89",
+"= c #8E8F8B",
+"- c #898B87",
+"; c #9C9D99",
+"> c #C2C4C2",
+", c #D2D2D1",
+"' c #A4A6A2",
+") c #91938E",
+"! c #90928E",
+"~ c #90928D",
+"{ c #8F918C",
+"] c #8D8F8A",
+"^ c #8A8C87",
+"/ c #B5B7B4",
+"( c #E1E1E0",
+"_ c #F3F3F3",
+": c #FBFBFB",
+"< c #FDFDFD",
+"[ c #FAFAFA",
+"} c #B1B2AF",
+"| c #DDDEDC",
+"1 c #FCFCFC",
+"2 c #ECEDEC",
+"3 c #FEFEFE",
+"4 c #F8F8F8",
+"5 c #F5F5F5",
+"6 c #F1F1F1",
+"7 c #EDEDED",
+"8 c #ECECEC",
+"9 c #A0A19E",
+"0 c #F6F6F5",
+"a c #F7F7F7",
+"b c #F2F2F2",
+"c c #F0F0F0",
+"d c #EFEFEF",
+"e c #8B8D88",
+"f c #838383",
+"g c #7F7F7F",
+"h c #E7E7E7",
+"i c #A1A29F",
+"j c #F6F6F6",
+"k c #EEEEEE",
+"l c #8E908B",
+"m c #C0C0C0",
+"n c #030303",
+"o c #000000",
+"p c #404040",
+"q c #A1A39F",
+"r c #8B8C88",
+"s c #DBDBDB",
+"t c #707070",
+"u c #171717",
+"v c #F4F4F4",
+"w c #EAEAEA",
+"x c #BBBCB9",
+"y c #D8D8D8",
+"z c #868686",
+"A c #464646",
+"B c #E3E3E3",
+"C c #A2A3A0",
+"D c #ECDCDC",
+"E c #E9CFCF",
+"F c #E8CECE",
+"G c #E8D4D4",
+"H c #EBEBEB",
+"I c #939490",
+"J c #969696",
+"K c #E8E8E8",
+"L c #A2A4A0",
+"M c #E9D0D0",
+"N c #DC5757",
+"O c #DB4E4E",
+"P c #DD6464",
+"Q c #D94545",
+"R c #D84141",
+"S c #E3ABAB",
+"T c #E9E9E9",
+"U c #A3A4A1",
+"V c #F3F3F2",
+"W c #E4A0A0",
+"X c #DB4B4B",
+"Y c #DA4646",
+"Z c #D94242",
+"` c #D83E3E",
+" . c #D73A3A",
+".. c #DB6767",
+"+. c #F1F1F0",
+"@. c #A4A5A1",
+"#. c #E7CBCB",
+"$. c #D94343",
+"%. c #D83F3F",
+"&. c #D63333",
+"*. c #D32323",
+"=. c #DD9696",
+"-. c #E5E5E5",
+";. c #8A8B87",
+">. c #DCDEDC",
+",. c #DC7070",
+"'. c #D11C1C",
+"). c #CE0B0B",
+"!. c #CC0101",
+"~. c #D13B3B",
+"{. c #E1DCDC",
+"]. c #E2E2E2",
+"^. c #E4E4E4",
+"/. c #B2B3AF",
+"(. c #F9F9F9",
+"_. c #E3E1E1",
+":. c #D56161",
+"<. c #CC0000",
+"[. c #D23D3D",
+"}. c #E1DADA",
+"|. c #E1E1E1",
+"1. c #DA9494",
+"2. c #E0DADA",
+"3. c #A3A5A1",
+"4. c #EFEFEE",
+"5. c #EAEAE9",
+"6. c #E0E0E0",
+"7. c #D1D2D0",
+"8. c #AFB1AE",
+"9. c #AAABA8",
+"0. c #EDEDEC",
+"a. c #888A86",
+"b. c #8D8E8A",
+"c. c #CACBC9",
+"d. c #9C9E9A",
+"e. c #8A8C88",
+"f. c #D8D8D7",
+"g. c #FFFFFF",
+"h. c #888985",
+"i. c #888A85",
+"j. c #898A86",
+" . ",
+" + @ . # $ % & ",
+" * = - ; > , ' ) ! ~ { ] ^ ^ ^ . . . = ",
+"] / ( _ : < [ } | 1 1 1 1 < < < < 1 1 1 2 ] ",
+"^ 3 4 5 6 7 8 9 0 a _ _ b b 6 6 c c d c : e ",
+"* : _ c f g h i j 5 6 c c c d d k 7 7 k : e ",
+"l c j m n o p q j 5 c c d d k k 7 8 8 k : r ",
+" s 4 t o o u q 5 v d d k k k 8 8 8 w 8 : ^ ",
+" x : y z A B C v v k k D E 8 F G w w H [ ^ ",
+" I < c d J K L v _ k M N O P Q R S T w : ^ ",
+" ] : _ c d k U V _ 7 W X Y Z ` ...h T : ^ ",
+" l +.j c d k @.b b 8 #.$.%. .&.*.=.-.K : ;.",
+" >.4 k 8 w C c c T w ,.'.).!.~.{.].^.: . ",
+" /.(.-.-.-.L d 7 ^.B _.:.<.[.}.].|.B : . ",
+" { < -.-.-.U d 8 B B B ].1.2.].|.|.B : . ",
+" ] (.T -.-.3.4.8 B B ].].].|.|.|.|.].: . ",
+" l 5.d -.-.@.7 8 B ].].].|.|.|.|.6.].: . ",
+" 7._ -.-.' 7 8 ].].].|.|.|.|.6.6.].: . ",
+" 8.: j 1 9.0.8 ].].|.].].|.|.|.].B 1 a.",
+" b.c.$ d.e.f.g.3 3 3 3 3 3 < < 1 1 w ^ ",
+" h.i.i.i.i.i.i.i.i.i.i.j.. ",
+" "};
Added: trunk/gtk/src/icons/cat-hardware.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-hardware.xpm?r…
==============================================================================
--- trunk/gtk/src/icons/cat-hardware.xpm (added)
+++ trunk/gtk/src/icons/cat-hardware.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,89 @@
+/* XPM */
+static const char * cat_hardware_xpm[] = {
+"22 22 64 1",
+" c None",
+". c #2A5700",
+"+ c #8AE234",
+"@ c #788600",
+"# c #6E7729",
+"$ c #555B38",
+"% c #8E9A23",
+"& c #53593A",
+"* c #535939",
+"= c #6B7526",
+"- c #849115",
+"; c #778500",
+"> c #83C020",
+", c #54593F",
+"' c #E0E1DC",
+") c #525741",
+"! c #525839",
+"~ c #CFD0CD",
+"{ c #585C41",
+"] c #768402",
+"^ c #5F6825",
+"/ c #4F543E",
+"( c #828578",
+"_ c #808276",
+": c #7F8275",
+"< c #808375",
+"[ c #7D8072",
+"} c #7E8174",
+"| c #4F5636",
+"1 c #636E1A",
+"2 c #4F543D",
+"3 c #DBDCD8",
+"4 c #BCBDB9",
+"5 c #BFC0BA",
+"6 c #ABACA8",
+"7 c #555753",
+"8 c #4F553C",
+"9 c #8C981F",
+"0 c #859215",
+"a c #878A7C",
+"b c #898C7C",
+"c c #51563A",
+"d c #798709",
+"e c #788405",
+"f c #849117",
+"g c #8A961D",
+"h c #849012",
+"i c #7A8804",
+"j c #889518",
+"k c #7B8905",
+"l c #89951A",
+"m c #839113",
+"n c #BEB400",
+"o c #828D04",
+"p c #EDD400",
+"q c #7D8A08",
+"r c #879104",
+"s c #FCE94F",
+"t c #7D8909",
+"u c #7D8A06",
+"v c #85CD28",
+"w c #8EB41D",
+"x c #275200",
+"y c #264E00",
+" ",
+" ",
+" ",
+" ................... ",
+" .+++++++++++++++++. ",
+" .+@@#$%&%*=%%-;;;>. ",
+" .+@@,')'!~{@]%-;;>. ",
+" .+^/(_:<[}(|1;%-;>. ",
+" .+23(44444(5)%%%;>. ",
+" .+^/(67777(/1@@%@>. ",
+" .+8'(((((((5)9%0@>. ",
+" .+^//a/b/b/c1@9@@>. ",
+" .+@@@/d/e/f0g@@h@>. ",
+" .+iijkk%k%kk9kklk>. ",
+" .+mnn@nnknnknnono>. ",
+" .+@pp@ppqppkpprpr>. ",
+" .+@ss@sstsskssusu>. ",
+" .v>ss>ss>ss>sswsw>. ",
+" x.................y ",
+" ",
+" ",
+" "};
Added: trunk/gtk/src/icons/cat-multimedia.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-multimedia.xpm…
==============================================================================
--- trunk/gtk/src/icons/cat-multimedia.xpm (added)
+++ trunk/gtk/src/icons/cat-multimedia.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,184 @@
+/* XPM */
+static const char * cat_multimedia_xpm[] = {
+"22 22 159 2",
+" c None",
+". c #2F3436",
+"+ c #34383A",
+"@ c #434748",
+"# c #5C5E5F",
+"$ c #2E3335",
+"% c #35393B",
+"& c #454849",
+"* c #4C4F51",
+"= c #585A5A",
+"- c #A2A2A2",
+"; c #DCDCDC",
+"> c #6C6C6C",
+", c #191919",
+"' c #353A3C",
+") c #2F3435",
+"! c #3A3E3F",
+"~ c #4A4E4F",
+"{ c #494C4D",
+"] c #D2D2D2",
+"^ c #D8D8D8",
+"/ c #1F1F1F",
+"( c #090909",
+"_ c #C9C9C9",
+": c #D0D0D0",
+"< c #111111",
+"[ c #3B4042",
+"} c #323738",
+"| c #404446",
+"1 c #505454",
+"2 c #767676",
+"3 c #8A8A8A",
+"4 c #E5E5E5",
+"5 c #999999",
+"6 c #0A0A0A",
+"7 c #616161",
+"8 c #DADADA",
+"9 c #8D8D8D",
+"0 c #050505",
+"a c #656565",
+"b c #A8AAAB",
+"c c #868888",
+"d c #414547",
+"e c #404445",
+"f c #3E4243",
+"g c #737373",
+"h c #5B5B5B",
+"i c #020202",
+"j c #9B9B9B",
+"k c #E6E6E6",
+"l c #2F2F2F",
+"m c #0E0E0E",
+"n c #C2C2C2",
+"o c #A6A8A9",
+"p c #4E5252",
+"q c #393D3F",
+"r c #383D3F",
+"s c #424748",
+"t c #C4C4C4",
+"u c #B6B6B6",
+"v c #9C9C9C",
+"w c #333333",
+"x c #E9E9E9",
+"y c #9B9D9D",
+"z c #575859",
+"A c #3F4446",
+"B c #B7B7B7",
+"C c #A7A7A7",
+"D c #7A7A7A",
+"E c #2E3436",
+"F c #2D3335",
+"G c #585858",
+"H c #B1B1B1",
+"I c #A5A5A5",
+"J c #666666",
+"K c #6F6F6F",
+"L c #A1A1A1",
+"M c #B4B4B4",
+"N c #949494",
+"O c #707070",
+"P c #7F7F7F",
+"Q c #BABABA",
+"R c #B3B3B3",
+"S c #6D6D6D",
+"T c #6B6B6B",
+"U c #C1C1C1",
+"V c #34393B",
+"W c #717171",
+"X c #757575",
+"Y c #777777",
+"Z c #808080",
+"` c #505050",
+" . c #000000",
+".. c #3E3E3E",
+"+. c #FCFCFC",
+"@. c #EDEDED",
+"#. c #1A1A1A",
+"$. c #FDFDFD",
+"%. c #676767",
+"&. c #5E5E5E",
+"*. c #373C3D",
+"=. c #CACACA",
+"-. c #A3A3A3",
+";. c #3A3A3A",
+">. c #4F4F4F",
+",. c #E8E8E8",
+"'. c #434343",
+"). c #AAAAAA",
+"!. c #F1F1F1",
+"~. c #BBBBBB",
+"{. c #E4E4E4",
+"]. c #4B4B4B",
+"^. c #BFBFBF",
+"/. c #444748",
+"(. c #404444",
+"_. c #414445",
+":. c #434546",
+"<. c #414446",
+"[. c #404344",
+"}. c #3F4243",
+"|. c #3F4244",
+"1. c #3E4142",
+"2. c #606264",
+"3. c #5C5C5C",
+"4. c #9D9D9D",
+"5. c #F6F6F6",
+"6. c #595959",
+"7. c #575757",
+"8. c #9F9F9F",
+"9. c #555555",
+"0. c #545454",
+"a. c #535353",
+"b. c #525252",
+"c. c #5E6161",
+"d. c #6C6E6F",
+"e. c #5A5A5A",
+"f. c #F4F4F4",
+"g. c #797979",
+"h. c #515151",
+"i. c #6A6C6C",
+"j. c #727475",
+"k. c #5F5F5F",
+"l. c #C5C5C5",
+"m. c #F7F7F7",
+"n. c #6E6F6F",
+"o. c #787A7A",
+"p. c #9A9A9A",
+"q. c #818282",
+"r. c #565656",
+"s. c #7D7D7D",
+"t. c #898989",
+"u. c #747474",
+"v. c #7B7B7B",
+"w. c #888888",
+"x. c #4E4E4E",
+"y. c #878787",
+"z. c #868686",
+"A. c #848484",
+"B. c #828282",
+" . + @ # ",
+" $ % & * = - ; > , ' ",
+" $ ) ! ~ { > ] ^ / ( _ : < , [ ",
+" } | 1 2 3 4 5 6 7 8 9 0 a b c d e f ",
+" d : g h i j k l m n o p q r % ",
+" s t u v w x y z @ A ",
+" ' B C t D E E F F F F F F F F F F F F E ",
+" F G v H I a J K L M N O P Q R S T Q U V ",
+" F Q W X Y Z ` ...+.@.#. .B $.%. .&.$.*. ",
+" F =.-.;.>.n ,.J '.).!.~.'.G {.{.7 ].^.+ ",
+" E E /.(._.:.:.<.<._._.(.[.}.|.}.1.1.q E ",
+" E 2.h 3.4.3.5.v 6.G 7.8.9.0.8.a.b.c.E ",
+" E d.e.%.$.v f.~.g.G 7.8.G 9.8.b.h.i.E ",
+" E j.k.8.l.m.l.; 8.l.l.8.8.l.8.6.h.n.E ",
+" E o.6.h $.3.h H h 3.I p.Q {.J 0.` 2 E ",
+" E q.r.8.8.8.8.8.8.8.l.l.8.$.8.h.` s.E ",
+" E t.9.9.9.9.9.9.0.0.a.a.u.h.h.` >.v.E ",
+" E w.a.0.0.0.0.a.a.a.b.b.h.` ` >.x.D E ",
+" E 3 w.w.w.y.y.y.y.z.z.z.A.A.A.B.B.g.E ",
+" E E E E E E E E E E E E E E E E E E E ",
+" ",
+" "};
Added: trunk/gtk/src/icons/cat-network.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-network.xpm?re…
==============================================================================
--- trunk/gtk/src/icons/cat-network.xpm (added)
+++ trunk/gtk/src/icons/cat-network.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,304 @@
+/* XPM */
+static const char * cat_network_xpm[] = {
+"22 22 279 2",
+" c None",
+". c #465586",
+"+ c #3E5E93",
+"@ c #32578F",
+"# c #264E8A",
+"$ c #224C88",
+"% c #2B528D",
+"& c #33558D",
+"* c #38558C",
+"= c #3E5D91",
+"- c #234D89",
+"; c #4570A7",
+"> c #5D89BC",
+", c #6A97C8",
+"' c #719DCC",
+") c #759FCD",
+"! c #6993C2",
+"~ c #4C75AB",
+"{ c #305088",
+"] c #4B6B9D",
+"^ c #4771A7",
+"/ c #6B98C9",
+"( c #93B5D9",
+"_ c #9EB8D9",
+": c #BED0E5",
+"< c #D6E4F4",
+"[ c #D9E5F2",
+"} c #F0F4F9",
+"| c #CBD8E8",
+"1 c #C4D6E9",
+"2 c #87A2C5",
+"3 c #6A85AD",
+"4 c #7C91B5",
+"5 c #98B1CF",
+"6 c #B2CAE4",
+"7 c #DAE2ED",
+"8 c #E6EDF7",
+"9 c #F4F9FE",
+"0 c #FDFEFF",
+"a c #FFFFFF",
+"b c #FDFDFE",
+"c c #F5F8FB",
+"d c #BBCCE0",
+"e c #6083B2",
+"f c #4A75AB",
+"g c #2B508A",
+"h c #8B95B5",
+"i c #C6D2E2",
+"j c #EDF2F8",
+"k c #FCFDFD",
+"l c #E7ECF5",
+"m c #E9F2FC",
+"n c #F4F9FF",
+"o c #FEFEFF",
+"p c #FCFDFE",
+"q c #F6F8FB",
+"r c #EAEEF4",
+"s c #D8E0EB",
+"t c #8EA6C6",
+"u c #6A92C1",
+"v c #406AA2",
+"w c #244884",
+"x c #7992B7",
+"y c #A4B9D3",
+"z c #BECCDD",
+"A c #D9E3EF",
+"B c #E9F4FF",
+"C c #EDF5FF",
+"D c #F6FAFF",
+"E c #F1F7FF",
+"F c #F3F8FD",
+"G c #E5ECF4",
+"H c #CCD8E8",
+"I c #A5BEDB",
+"J c #9DB5D2",
+"K c #C8D3E3",
+"L c #D2DCE8",
+"M c #88ABD1",
+"N c #264E88",
+"O c #9FA7C1",
+"P c #6787B2",
+"Q c #6F8EB8",
+"R c #9BB2D1",
+"S c #DFEEFC",
+"T c #EFF7FF",
+"U c #E8F3FF",
+"V c #DEEEFF",
+"W c #E0EFFF",
+"X c #DFEDFB",
+"Y c #BCD0E6",
+"Z c #6788B4",
+"` c #587DAE",
+" . c #688EBC",
+".. c #688DBB",
+"+. c #5F81AE",
+"@. c #DDE5EF",
+"#. c #7F98BD",
+"$. c #5D75A1",
+"%. c #8AA7CA",
+"&. c #CBDCEF",
+"*. c #E5EEF8",
+"=. c #E9F2FB",
+"-. c #EDF6FE",
+";. c #D6EAFF",
+">. c #D3E9FF",
+",. c #CEE5FC",
+"'. c #B5CFED",
+"). c #4D72A6",
+"!. c #466DA2",
+"~. c #40689F",
+"{. c #3B649C",
+"]. c #39639C",
+"^. c #436CA3",
+"/. c #7B98BE",
+"(. c #C0CDDF",
+"_. c #426193",
+":. c #385B92",
+"<. c #A3BEDC",
+"[. c #E8EEF5",
+"}. c #FAFBFD",
+"|. c #F2F7FC",
+"1. c #E5EFFA",
+"2. c #C7DFF8",
+"3. c #C6DEF8",
+"4. c #BFD9F4",
+"5. c #8FAFD4",
+"6. c #476EA3",
+"7. c #436AA0",
+"8. c #3E679E",
+"9. c #39639B",
+"0. c #345F99",
+"a. c #3E6CA4",
+"b. c #91A9C7",
+"c. c #7F9FC5",
+"d. c #8195B7",
+"e. c #335991",
+"f. c #AAC5E1",
+"g. c #F8F9FC",
+"h. c #FEFEFE",
+"i. c #EFF3F7",
+"j. c #C7D9EB",
+"k. c #B7D1EE",
+"l. c #B4D0EE",
+"m. c #AFCCEB",
+"n. c #96B6DB",
+"o. c #446CA1",
+"p. c #3B659C",
+"q. c #37619A",
+"r. c #325D97",
+"s. c #315E98",
+"t. c #7796BE",
+"u. c #739AC7",
+"v. c #204986",
+"w. c #2C528B",
+"x. c #8EB0D6",
+"y. c #F9FAFC",
+"z. c #F6F8FA",
+"A. c #BDCCDF",
+"B. c #9AB9DA",
+"C. c #A2C2E4",
+"D. c #9EBFE2",
+"E. c #97B9DE",
+"F. c #789ECA",
+"G. c #7299C6",
+"H. c #4C76AB",
+"I. c #345F98",
+"J. c #305B96",
+"K. c #7C97BC",
+"L. c #85A2C4",
+"M. c #6A96C7",
+"N. c #254A86",
+"O. c #9DB6D5",
+"P. c #EEF3F9",
+"Q. c #D6DFEB",
+"R. c #D7E0EB",
+"S. c #E3E9F1",
+"T. c #97ACCA",
+"U. c #6F94C0",
+"V. c #8DB1D8",
+"W. c #87ACD5",
+"X. c #7EA6D0",
+"Y. c #749DCB",
+"Z. c #5D86B8",
+"`. c #4E73A6",
+" + c #5074A6",
+".+ c #88A2C4",
+"++ c #6688B2",
+"@+ c #204A87",
+"#+ c #879DC0",
+"$+ c #C2D4E7",
+"%+ c #94ADCD",
+"&+ c #859FC1",
+"*+ c #5578A8",
+"=+ c #DBE2ED",
+"-+ c #CBD8E7",
+";+ c #88ACD3",
+">+ c #769FCC",
+",+ c #6F99C8",
+"'+ c #729BC8",
+")+ c #81A2C9",
+"!+ c #89A1C2",
+"~+ c #AABBD3",
+"{+ c #ADBED5",
+"]+ c #7393BA",
+"^+ c #9AABC6",
+"/+ c #8FAED2",
+"(+ c #628EC0",
+"_+ c #3E69A1",
+":+ c #3C649C",
+"<+ c #42699F",
+"[+ c #7B9CC3",
+"}+ c #D6E2EF",
+"|+ c #BCCFE4",
+"1+ c #7DA2CB",
+"2+ c #ADC3DA",
+"3+ c #F2F5F8",
+"4+ c #F8F9FB",
+"5+ c #C8D3E2",
+"6+ c #80A5CE",
+"7+ c #28518B",
+"8+ c #395C91",
+"9+ c #446DA3",
+"0+ c #6C98C8",
+"a+ c #406CA5",
+"b+ c #305C96",
+"c+ c #3E6AA2",
+"d+ c #5F8BBE",
+"e+ c #90AFD2",
+"f+ c #C1D2E5",
+"g+ c #D4DFED",
+"h+ c #D4E0ED",
+"i+ c #F7F9FB",
+"j+ c #E5EBF2",
+"k+ c #8DA4C4",
+"l+ c #456493",
+"m+ c #244A83",
+"n+ c #648EBF",
+"o+ c #356099",
+"p+ c #4272AB",
+"q+ c #497BB3",
+"r+ c #4779B2",
+"s+ c #4376B0",
+"t+ c #5B86B6",
+"u+ c #CCD8E7",
+"v+ c #F3F5F9",
+"w+ c #FCFCFD",
+"x+ c #FBFCFD",
+"y+ c #E0E4EB",
+"z+ c #94A4BB",
+"A+ c #1D447C",
+"B+ c #406BA3",
+"C+ c #5D85B5",
+"D+ c #507BAD",
+"E+ c #698DB7",
+"F+ c #8BA6C5",
+"G+ c #B7C6D9",
+"H+ c #99ADC7",
+"I+ c #A4B3CB",
+"J+ c #CAD3E1",
+"K+ c #D6DBE2",
+"L+ c #B4BCC7",
+"M+ c #A0A5AA",
+"N+ c #1C3D6E",
+"O+ c #5D83B2",
+"P+ c #85A6CC",
+"Q+ c #7CA4CF",
+"R+ c #9CBCDD",
+"S+ c #749ECB",
+"T+ c #5983B5",
+"U+ c #4B6C9B",
+"V+ c #526B8F",
+"W+ c #768599",
+"X+ c #939393",
+"Y+ c #405B82",
+"Z+ c #1D437A",
+"`+ c #1F4783",
+" @ c #1F4986",
+".@ c #1C4278",
+"+@ c #173561",
+" ",
+" . + @ # $ % & * ",
+" = - ; > , ' ) ! ~ - { ",
+" ] ^ / ( _ : < [ } | 1 2 3 ",
+" 4 5 6 7 8 9 0 a b c d e ! f g ",
+" h i j k l m n o o p q r s t u v w ",
+" x y z A B C D E F G H I J K L M N ",
+" O P Q R S T U V W X Y Z ` ...+.@.#. ",
+" $.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._. ",
+" :.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.c.d. ",
+" e.f.g.h.i.j.k.l.m.n.o.~.p.q.r.s.t.u.v. ",
+" w.x.y.a z.A.B.C.D.E.F.G.H.I.J.K.L.M.v. ",
+" N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++> @+ ",
+" #+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+; @+ ",
+" ^+/+(+_+:+<+[+}+|+1+1+2+3+4+5+6+7+ ",
+" 8+9+0+a+b+c+d+e+f+g+h+i+a h.j+k+l+ ",
+" m+f n+o+p+q+r+s+t+u+v+w+x+y+z+ ",
+" A+B+/ C+D+E+F+G+H+I+J+K+L+M+ ",
+" N+- O+P+Q+R+S+T+U+V+W+X+ ",
+" Y+Z+`+ @`+.@+@ ",
+" ",
+" "};
Added: trunk/gtk/src/icons/cat-office.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-office.xpm?rev…
==============================================================================
--- trunk/gtk/src/icons/cat-office.xpm (added)
+++ trunk/gtk/src/icons/cat-office.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,201 @@
+/* XPM */
+static const char * cat_office_xpm[] = {
+"22 22 176 2",
+" c None",
+". c #6587B3",
+"+ c #5A81B3",
+"@ c #547DB2",
+"# c #5980B3",
+"$ c #BAC9DD",
+"% c #B7C9DF",
+"& c #5981B4",
+"* c #75551A",
+"= c #5B451C",
+"- c #577FB3",
+"; c #C5D3E4",
+"> c #6C92C0",
+", c #AEC2DA",
+"' c #557EB2",
+") c #7F5F22",
+"! c #D1BA80",
+"~ c #A0854B",
+"{ c #567EB2",
+"] c #3F6FAB",
+"^ c #7799C3",
+"/ c #9EB6D2",
+"( c #CBB27E",
+"_ c #E4DAAB",
+": c #9A7D40",
+"< c #587FB2",
+"[ c #658EBE",
+"} c #83A3C8",
+"| c #9FB7D3",
+"1 c #527CB1",
+"2 c #987C45",
+"3 c #DBB46A",
+"4 c #BC8D36",
+"5 c #765619",
+"6 c #577EB2",
+"7 c #6E95C1",
+"8 c #7C9DC5",
+"9 c #99B3D0",
+"0 c #527BB0",
+"a c #C4A770",
+"b c #D09B37",
+"c c #85601D",
+"d c #5B81B3",
+"e c #5880B4",
+"f c #7399C4",
+"g c #90ACCC",
+"h c #93ACCD",
+"i c #577DAE",
+"j c #9A9A98",
+"k c #9A9B99",
+"l c #999997",
+"m c #949492",
+"n c #8F908E",
+"o c #907440",
+"p c #DBB369",
+"q c #B88321",
+"r c #745415",
+"s c #5E83B3",
+"t c #6589B7",
+"u c #7599C2",
+"v c #9AB4D1",
+"w c #7E9EC4",
+"x c #FFFFFF",
+"y c #BB9C64",
+"z c #D19D3B",
+"A c #87631D",
+"B c #888A85",
+"C c #5D82B3",
+"D c #678BB9",
+"E c #6F94BF",
+"F c #9DB6D3",
+"G c #7093BE",
+"H c #6688B3",
+"I c #DBDBDA",
+"J c #D9D9D8",
+"K c #CEC2AB",
+"L c #DAB268",
+"M c #BB8520",
+"N c #79602D",
+"O c #778BA5",
+"P c #6F96C2",
+"Q c #668DBB",
+"R c #9CB5D2",
+"S c #C9C3B7",
+"T c #B59558",
+"U c #D29F3F",
+"V c #8C651B",
+"W c #EEEEEC",
+"X c #8C98A6",
+"Y c #6382A7",
+"Z c #7094BE",
+"` c #6C92BD",
+" . c #98B2D0",
+".. c #7296BF",
+"+. c #6586B2",
+"@. c #D8B166",
+"#. c #BE8E33",
+"$. c #8D8979",
+"%. c #EFEFEE",
+"&. c #FEFEFE",
+"*. c #E7ECF2",
+"=. c #929695",
+"-. c #969996",
+";. c #949796",
+">. c #929694",
+",. c #969790",
+"'. c #97968D",
+"). c #919189",
+"!. c #FDFDFD",
+"~. c #F4F4F4",
+"{. c #E9E9E9",
+"]. c #F3F6F9",
+"^. c #FBFCFD",
+"/. c #B0C4DC",
+"(. c #A2B9D3",
+"_. c #97AEC6",
+":. c #C3B191",
+"<. c #C4BDB1",
+"[. c #FAFBFC",
+"}. c #C8BFAF",
+"|. c #A6BCD5",
+"1. c #99B1CE",
+"2. c #8DA1B6",
+"3. c #D9D9D9",
+"4. c #EBEBEB",
+"5. c #F4F4F3",
+"6. c #EAE5DD",
+"7. c #C8BEAD",
+"8. c #C1B59D",
+"9. c #A7BCD4",
+"0. c #A9B8CA",
+"a. c #92AAC7",
+"b. c #E3E3E2",
+"c. c #F5F5F5",
+"d. c #D2CBBC",
+"e. c #CFC1A9",
+"f. c #BDB198",
+"g. c #BDB7A9",
+"h. c #91A9C5",
+"i. c #7E9DC1",
+"j. c #D4D4D2",
+"k. c #F8F8F8",
+"l. c #878984",
+"m. c #FCFCFC",
+"n. c #C7C1B4",
+"o. c #C9BAA2",
+"p. c #D7C6B2",
+"q. c #D0C3B5",
+"r. c #CBCCCC",
+"s. c #D7D7D7",
+"t. c #91A5BB",
+"u. c #A4B8CE",
+"v. c #F5F6F5",
+"w. c #787A76",
+"x. c #D8D8D8",
+"y. c #F2F2F2",
+"z. c #D0CBC2",
+"A. c #C7B69C",
+"B. c #CEC2B0",
+"C. c #D0CDCB",
+"D. c #CECDCD",
+"E. c #C4C4C4",
+"F. c #DCDCDC",
+"G. c #EFEFEF",
+"H. c #7C7E7A",
+"I. c #82847F",
+"J. c #DADADA",
+"K. c #FBFBFB",
+"L. c #FAF9F8",
+"M. c #FAFAF9",
+"N. c #F6F6F6",
+"O. c #F7F7F7",
+"P. c #C6C7C6",
+"Q. c #747571",
+"R. c #81837E",
+"S. c #71736F",
+". + @ ",
+"# $ % & * = ",
+"- ; > , ' ) ! ~ ",
+". { ] ^ / ' ( _ : ",
+" { < [ } | 1 2 3 4 5 ",
+" - 6 7 8 9 0 a b c ",
+" - d e f g h i j k l m n o p q r ",
+" - # s t u v w . x x x x y z A B ",
+" { d C D E F G H I J K L M N B ",
+" { O + P Q R G H S T U V W B ",
+" B X Y Z ` ...+.@.#.$.%.B ",
+" B &.*.=.-.;.>.,.'.).!.~.B ",
+" B &.&.x x x x x x x {.~.B ",
+" B &.&.].^./.(._.:.<.{.~.B ",
+" B &.&.x [.}.|.1.2.3.4.5.B ",
+" B &.&.x 6.7.8.9.0.a.b.c.B ",
+" B &.!.x d.e.f.g.h.i.j.k.B ",
+" l.m.c.n.o.p.q.r.s.t.u.v.l. ",
+" w.x.y.z.A.B.C.D.E.F.G.{.H. ",
+" I.J.K.L.M.N.c.N.O.P.I. ",
+" Q.I.B B B B B R.S. ",
+" "};
Added: trunk/gtk/src/icons/cat-system.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-system.xpm?rev…
==============================================================================
--- trunk/gtk/src/icons/cat-system.xpm (added)
+++ trunk/gtk/src/icons/cat-system.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,273 @@
+/* XPM */
+static const char * cat_system_xpm[] = {
+"22 22 248 2",
+" c None",
+". c #3A5A8A",
+"+ c #3465A4",
+"@ c #8A9BBA",
+"# c #7F92B2",
+"$ c #7988AC",
+"% c #345F99",
+"& c #537BAE",
+"* c #8A9BB8",
+"= c #5E769E",
+"- c #7484A6",
+"; c #35609A",
+"> c #5F76A2",
+", c #466594",
+"' c #BBC3D3",
+") c #9DA7BC",
+"! c #7796C1",
+"~ c #9DA9C4",
+"{ c #5B729D",
+"] c #8794B1",
+"^ c #7786A5",
+"/ c #969BB8",
+"( c #7A89AF",
+"_ c #34619E",
+": c #899DBB",
+"< c #ABB7CC",
+"[ c #BEC7D8",
+"} c #BFC6D6",
+"| c #C3C8D5",
+"1 c #A3AFC7",
+"2 c #919FBC",
+"3 c #5D739D",
+"4 c #5E749E",
+"5 c #6378A1",
+"6 c #798AAE",
+"7 c #6D7C9C",
+"8 c #7E8FB0",
+"9 c #687BA3",
+"0 c #8A94B5",
+"a c #A1A1BC",
+"b c #466FA8",
+"c c #3D5E92",
+"d c #BFC7D5",
+"e c #BEC7D7",
+"f c #AFB9CF",
+"g c #ADB7CD",
+"h c #7183AA",
+"i c #6377A1",
+"j c #6578A2",
+"k c #6679A3",
+"l c #687AA4",
+"m c #6A7BA5",
+"n c #6C7DA6",
+"o c #6D7EA7",
+"p c #808CB1",
+"q c #8490B4",
+"r c #3E68A4",
+"s c #476CA0",
+"t c #C6CDDC",
+"u c #B2BCD1",
+"v c #9FABC5",
+"w c #7283AA",
+"x c #909DBB",
+"y c #B2BBD0",
+"z c #AAB4CB",
+"A c #94A0BE",
+"B c #7383AA",
+"C c #7584AB",
+"D c #969EBE",
+"E c #496BA0",
+"F c #6683AC",
+"G c #C5CBDB",
+"H c #B6BFD3",
+"I c #ACB6CD",
+"J c #B0B8CF",
+"K c #A0A7BD",
+"L c #6F7F9E",
+"M c #7A87A4",
+"N c #99A2BB",
+"O c #9CA6C3",
+"P c #AAB2CB",
+"Q c #7D89B0",
+"R c #848FB4",
+"S c #888EAB",
+"T c #3462A0",
+"U c #5C83B6",
+"V c #B6C2D7",
+"W c #B9C1D5",
+"X c #ACB5CD",
+"Y c #A5AEC9",
+"Z c #969FB5",
+"` c #376099",
+" . c #929BB3",
+".. c #9FA7C4",
+"+. c #A2AAC6",
+"@. c #98A0C0",
+"#. c #B1B6CD",
+"$. c #A2ABBF",
+"%. c #B0B7C8",
+"&. c #C7CBD9",
+"*. c #BFC6D8",
+"=. c #A3ACC7",
+"-. c #9DA6C3",
+";. c #405E8D",
+">. c #4D5575",
+",. c #ACB1CA",
+"'. c #D1D4E3",
+"). c #BFC3D8",
+"!. c #BFC1D7",
+"~. c #A7AAC7",
+"{. c #9EA1BE",
+"]. c #9A9DB7",
+"^. c #C0C5D9",
+"/. c #ABB2CC",
+"(. c #B0B7CF",
+"_. c #9BA3C2",
+":. c #8E97BA",
+"<. c #858EB5",
+"[. c #C6C9D7",
+"}. c #35619C",
+"|. c #A2A7BE",
+"1. c #E0E2EC",
+"2. c #B7B9D3",
+"3. c #989BC0",
+"4. c #999CC1",
+"5. c #9B9DC2",
+"6. c #AAACCA",
+"7. c #8E95B1",
+"8. c #9299B7",
+"9. c #9DA5C4",
+"0. c #8992B7",
+"a. c #8B93B8",
+"b. c #8C94B9",
+"c. c #C7CBD8",
+"d. c #3B5F94",
+"e. c #CCCEDE",
+"f. c #DADBE8",
+"g. c #9EA0C3",
+"h. c #A4A6C7",
+"i. c #A7A8C3",
+"j. c #9A9BB7",
+"k. c #9395B0",
+"l. c #3464A3",
+"m. c #9EA3C4",
+"n. c #9398BD",
+"o. c #9499BE",
+"p. c #BDC0D7",
+"q. c #858FA9",
+"r. c #3464A2",
+"s. c #7F86A0",
+"t. c #DCDDEA",
+"u. c #C0C0D8",
+"v. c #A6A5C8",
+"w. c #B2B1CF",
+"x. c #4A5D84",
+"y. c #5274A8",
+"z. c #9A9EC1",
+"A. c #9C9FC2",
+"B. c #CECFE0",
+"C. c #939DB4",
+"D. c #4D638C",
+"E. c #5A6D93",
+"F. c #8C92AD",
+"G. c #DEDEEA",
+"H. c #E0E0EB",
+"I. c #ABAACB",
+"J. c #ADABCC",
+"K. c #9698B4",
+"L. c #375F98",
+"M. c #657EAC",
+"N. c #AEB0CD",
+"O. c #A4A4C7",
+"P. c #A7A6C9",
+"Q. c #C3C3DA",
+"R. c #DBDAE9",
+"S. c #DDDCEA",
+"T. c #D2D0E3",
+"U. c #CFCCE1",
+"V. c #B3AFD0",
+"W. c #B8B4D3",
+"X. c #8389A7",
+"Y. c #3364A3",
+"Z. c #436EA7",
+"`. c #ACB0C7",
+" + c #ADABCD",
+".+ c #ACA9CC",
+"++ c #AEAACD",
+"@+ c #AFABCE",
+"#+ c #B1ADCF",
+"$+ c #B3AED0",
+"%+ c #B4AFD0",
+"&+ c #B8B2D2",
+"*+ c #D7D3E5",
+"=+ c #D7D3E6",
+"-+ c #BBB4D4",
+";+ c #BDB5D5",
+">+ c #BAB5CF",
+",+ c #8C93B3",
+"'+ c #3463A1",
+")+ c #A2A9C5",
+"!+ c #B7B5D3",
+"~+ c #B2AECF",
+"{+ c #BEBBD6",
+"]+ c #C0BCD8",
+"^+ c #B8B2D3",
+"/+ c #BAB4D4",
+"(+ c #BCB5D5",
+"_+ c #BEB6D6",
+":+ c #C6C0DC",
+"<+ c #DED9EA",
+"[+ c #B9B3CD",
+"}+ c #C8BEDC",
+"|+ c #C7BDDC",
+"1+ c #A2A1BB",
+"2+ c #36629D",
+"3+ c #33609B",
+"4+ c #476DA4",
+"5+ c #BFBAD8",
+"6+ c #ADACC6",
+"7+ c #456290",
+"8+ c #697CA5",
+"9+ c #C2BCD6",
+"0+ c #C4BBD9",
+"a+ c #C4BAD9",
+"b+ c #C7BED9",
+"c+ c #949CBE",
+"d+ c #385F9A",
+"e+ c #335E97",
+"f+ c #8793B9",
+"g+ c #ADB1D2",
+"h+ c #747B9A",
+"i+ c #305A92",
+"j+ c #325C93",
+"k+ c #446DA8",
+"l+ c #5175AD",
+"m+ c #2F5C96",
+"n+ c #284D7E",
+"o+ c #CFC5E0",
+"p+ c #C9BEDD",
+"q+ c #5D7DB2",
+"r+ c #22426C",
+"s+ c #2C568B",
+"t+ c #3F6599",
+"u+ c #2C5285",
+"v+ c #305E98",
+"w+ c #CCC1DE",
+"x+ c #2D578F",
+"y+ c #2F5B95",
+" . + + + + ",
+" + @ # $ + + ",
+" % & + * = - + ; > + ",
+" , ' ) + + + ! ~ { ] + + + ^ / ( + ",
+" _ : < [ } | 1 2 3 4 5 6 7 8 9 0 a b ",
+" c d e f g h i j k l m n o p q r ",
+" s t u v w x y y z A B C D E ",
+" F G H I J K L M N O P Q R S T ",
+"+ + + U V W X Y Z ` ...+.@.#.+ + + + ",
+"+ $.%.&.*.=.-.&.;. >.,.'.).!.~.{.].+ ",
+"+ ^./.(._.:.<.[.}. |.1.2.3.4.5.6.+ ",
+"+ 7.8.9.0.a.b.c.d. e.f.g.h.i.j.k.+ ",
+"l.+ + + m.n.o.p.q.r. s.t.u.v.w.x.+ + + ",
+" y.z.A.g.B.C.D.E.F.G.H.I.J.K.L. ",
+" l.M.N.O.v.P.Q.R.S.T.U.U.V.W.X.l. ",
+" Y.Z.`. +.+++@+#+$+%+&+*+=+-+;+>+,++ ",
+" '+)+!+~+{+]+^+^+/+(+_+:+<+[+}+|+1+2+ ",
+" 3+4+5+6++ 7+8+9+0+a+b+c+d+e+f+g+h+i+ ",
+" j+k+l+m+ n++ o+p+p+q+r+ s+t+u+ ",
+" v+ + S.w+S.+ ",
+" + S.S.S.+ ",
+" x++ + + y+ "};
Added: trunk/gtk/src/icons/cat-utilities.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/cat-utilities.xpm?…
==============================================================================
--- trunk/gtk/src/icons/cat-utilities.xpm (added)
+++ trunk/gtk/src/icons/cat-utilities.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,240 @@
+/* XPM */
+static const char * cat_utilities_xpm[] = {
+"22 22 215 2",
+" c None",
+". c #8F918C",
+"+ c #8D8F8A",
+"@ c #888A85",
+"# c #90928E",
+"$ c #91938E",
+"% c #C2C4C1",
+"& c #9C9D99",
+"* c #90928D",
+"= c #D2D3D1",
+"- c #929490",
+"; c #C4A000",
+"> c #939590",
+", c #D7D8D6",
+"' c #E2E2E2",
+") c #9F9F9C",
+"! c #9B9C98",
+"~ c #ABACA8",
+"{ c #E3E3E3",
+"] c #D0D1D0",
+"^ c #A0A19D",
+"/ c #C6A304",
+"( c #EBEBEB",
+"_ c #DCDDDC",
+": c #8C8E89",
+"< c #E3E3E2",
+"[ c #E0E0E0",
+"} c #D8D9D8",
+"| c #959792",
+"1 c #C5A202",
+"2 c #D5B934",
+"3 c #C4A104",
+"4 c #9D9E9A",
+"5 c #E8E8E8",
+"6 c #E1E1E1",
+"7 c #B2B3B1",
+"8 c #A4A6A2",
+"9 c #C5C6C3",
+"0 c #DFDFDF",
+"a c #989A95",
+"b c #C8A710",
+"c c #FAF1AE",
+"d c #C5A105",
+"e c #E0E0DF",
+"f c #92948F",
+"g c #DEDEDE",
+"h c #CBCCCB",
+"i c #91938F",
+"j c #C6A203",
+"k c #F3E690",
+"l c #FDF6BD",
+"m c #C9C9C8",
+"n c #AAABA8",
+"o c #949691",
+"p c #D4D5D3",
+"q c #DDDDDD",
+"r c #E6D162",
+"s c #FAF09E",
+"t c #C5A204",
+"u c #C5A004",
+"v c #C2C3C0",
+"w c #9C9E9A",
+"x c #A4A5A2",
+"y c #DCDCDC",
+"z c #B1B2B0",
+"A c #D4B82F",
+"B c #FCF3AE",
+"C c #FBE95B",
+"D c #FBF1AC",
+"E c #8A8C87",
+"F c #EAEAE9",
+"G c #D6D6D6",
+"H c #A9ABA7",
+"I c #C1C3C1",
+"J c #DBDBDB",
+"K c #DEDEDD",
+"L c #C8A60D",
+"M c #F9EEA4",
+"N c #FAE96B",
+"O c #F8E44A",
+"P c #FBF2AC",
+"Q c #ADAEAB",
+"R c #B0B2AF",
+"S c #BEBFBD",
+"T c #979995",
+"U c #C6A202",
+"V c #F0E182",
+"W c #F9EB82",
+"X c #ECD539",
+"Y c #F2DD41",
+"Z c #C3A003",
+"` c #DFE0DE",
+" . c #DADADA",
+".. c #D8D8D8",
+"+. c #B3B4B1",
+"@. c #BABCBA",
+"#. c #C6A303",
+"$. c #E2CB54",
+"%. c #F9ED96",
+"&. c #F2DC43",
+"*. c #CBA90A",
+"=. c #F1DB3F",
+"-. c #F8EEA0",
+";. c #9B8F8B",
+">. c #BFC0BE",
+",. c #A99592",
+"'. c #D1B426",
+"). c #F8EC9D",
+"!. c #F2DE4E",
+"~. c #D6B719",
+"{. c #EED83D",
+"]. c #F7EB9B",
+"^. c #B00606",
+"/. c #946F6B",
+"(. c #B6B3B1",
+"_. c #B32304",
+":. c #C7A40A",
+"<. c #F2DF5E",
+"[. c #E2C82B",
+"}. c #E9D237",
+"|. c #C4A003",
+"1. c #B30808",
+"2. c #B50909",
+"3. c #AE0505",
+"4. c #DA3130",
+"5. c #C73A39",
+"6. c #AA0303",
+"7. c #AE0504",
+"8. c #B6100C",
+"9. c #CA582F",
+"0. c #E0B62E",
+"a. c #E9D135",
+"b. c #F1E288",
+"c. c #C4A103",
+"d. c #D41A1A",
+"e. c #DC1F1F",
+"f. c #E12121",
+"g. c #B71809",
+"h. c #B94E04",
+"i. c #E6CD31",
+"j. c #F0E286",
+"k. c #AD0505",
+"l. c #DC1E1E",
+"m. c #C41111",
+"n. c #CE1717",
+"o. c #CB1515",
+"p. c #A40000",
+"q. c #AE5855",
+"r. c #AD2F00",
+"s. c #B31309",
+"t. c #C51D12",
+"u. c #AD0504",
+"v. c #E1C72B",
+"w. c #C3A002",
+"x. c #AE1211",
+"y. c #E72525",
+"z. c #C91313",
+"A. c #D71C1C",
+"B. c #B10707",
+"C. c #BA6A04",
+"D. c #C46215",
+"E. c #B64403",
+"F. c #B0200F",
+"G. c #E1C629",
+"H. c #ECDB78",
+"I. c #AE0D0C",
+"J. c #EF2929",
+"K. c #BE0D0D",
+"L. c #B20808",
+"M. c #E22222",
+"N. c #B40909",
+"O. c #C5A101",
+"P. c #E4CF5E",
+"Q. c #BA1F12",
+"R. c #B41608",
+"S. c #C07A05",
+"T. c #BE0F0C",
+"U. c #B22A0A",
+"V. c #C9A707",
+"W. c #DFC326",
+"X. c #EAD770",
+"Y. c #B00909",
+"Z. c #CC1515",
+"`. c #C71111",
+" + c #E32323",
+".+ c #B60A0A",
+"++ c #D7BD39",
+"@+ c #ECDA74",
+"#+ c #C86A19",
+"$+ c #BA1C0D",
+"%+ c #CC1715",
+"&+ c #B41A0B",
+"*+ c #DDC124",
+"=+ c #DBBF22",
+"-+ c #C5A102",
+";+ c #C4A002",
+">+ c #BC0D0D",
+",+ c #C51212",
+"'+ c #D81A1A",
+")+ c #D01818",
+"!+ c #CBAA16",
+"~+ c #EAD978",
+"{+ c #EBD97A",
+"]+ c #EAD876",
+"^+ c #CA5B33",
+"/+ c #D06B38",
+"(+ c #E5D165",
+"_+ c #E4D063",
+":+ c #E2CE5F",
+"<+ c #B20707",
+"[+ c #C4A001",
+"}+ c #BB6104",
+"|+ c #B63005",
+"1+ c #B73006",
+"2+ c #BD5A05",
+" . + @ # ",
+" $ % & * = - @ ; ",
+" > , ' ) ! > ~ { ] ^ / ; ",
+" . ( ' _ ! : < [ } | 1 2 3 ",
+" @ 4 5 6 7 8 | 9 0 ' a b c d ",
+" @ e [ [ a f 6 g h i j k l d ",
+" @ * ( 0 m n o p q ' : / r s t u ",
+" @ v [ q 4 w x y y z > 1 A B C D 3 ",
+" E F y G H I J K | L M N O P 3 ",
+" @ Q 0 J R S y T U V W X Y ; Z ",
+" E ` ...+.@.! #.$.%.&.*.=.-.3 ",
+" @ ;.' ..>.,. '.).!.~.; {.].3 ",
+" ^./.(. (./._.:.k <.[.1 ; }.t |. ",
+" 1.2.3.4.5.6.5.4.7.8.9.0.#. ; a.b.c. ",
+" 2.d.e.f.f.6.6.6.f.f.e.d.g.h. ; i.j.c. ",
+" k.l.m.^.n.o.p.q.r.o.n.s.t.l.u. ; v.; w. ",
+"x.y.z.3.6.A.B. C.B.A.D.E.z.y.F.; G.H.c. ",
+"I.J.K. L.M.N. O.P.Q.M.R.S.T.J.U.V.W.X.c. ",
+"Y.f.Z.`. +.+ 1 ++@+#+$+ +`.%+f.&+*+=+-+;+ ",
+">+,+'+)+.+.+ !+~+{+]+^+.+)+'+,+/+(+_+:+c. ",
+" 1.<+ ; [+c.c.c.c.}+|+1+2+c.c.c.c.; ",
+" "};
Added: trunk/gtk/src/icons/pkg-3D.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-3D.xpm?rev=432…
==============================================================================
--- trunk/gtk/src/icons/pkg-3D.xpm (added)
+++ trunk/gtk/src/icons/pkg-3D.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,76 @@
+/* XPM */
+static const char * pkg_3D_xpm[] = {
+"32 32 41 1",
+" c None",
+". c #000000",
+"+ c #151515",
+"@ c #5A5A5A",
+"# c #727272",
+"$ c #3F3F3F",
+"% c #040404",
+"& c #797979",
+"* c #787878",
+"= c #6B6B6B",
+"- c #454545",
+"; c #080808",
+"> c #060606",
+", c #737373",
+"' c #090909",
+") c #686868",
+"! c #0A0A0A",
+"~ c #3E3E3E",
+"{ c #020202",
+"] c #343434",
+"^ c #2E2E2E",
+"/ c #1B1B1B",
+"( c #010101",
+"_ c #2A2A2A",
+": c #6A6A6A",
+"< c #565656",
+"[ c #636363",
+"} c #2D2D2D",
+"| c #0E0E0E",
+"1 c #1C1C1C",
+"2 c #434343",
+"3 c #121212",
+"4 c #050505",
+"5 c #575757",
+"6 c #242424",
+"7 c #030303",
+"8 c #545454",
+"9 c #0D0D0D",
+"0 c #555555",
+"a c #393939",
+"b c #6E6E6E",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ...... ......... ",
+" ........ .......... ",
+" ........+ ........... ",
+" ..@##$..%& ...&&*=-;..> ",
+" &&&,..'&& ...&&&&&)!..~ ",
+" &, {..]&& ...&& ^../& ",
+" ....(,&& ...&& ..'& ",
+" ...(_:&& ...&& ..(&& ",
+" .....>< ...&& ..;&& ",
+" [}..| ...&& ..1&& ",
+" &#..{& ...&& ...2&& ",
+" . {..3&&...&& ...4#&& ",
+" .........2&&...........5&& ",
+" ........6*&&.........78&&& ",
+" .9%(!60&&& ......7+ab&&& ",
+" &&&&&&&&& &&&&&&&&&& ",
+" &&&&&& &&&&&&&&& ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
Added: trunk/gtk/src/icons/pkg-available-locked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-available-lock…
==============================================================================
--- trunk/gtk/src/icons/pkg-available-locked.xpm (added)
+++ trunk/gtk/src/icons/pkg-available-locked.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,553 @@
+/* XPM */
+static const char * pkg_available_locked_xpm[] = {
+"32 32 518 2",
+" c None",
+". c #3E4174",
+"+ c #3F4275",
+"@ c #3D3E71",
+"# c #3A3B6C",
+"$ c #3C3E71",
+"% c #3E4074",
+"& c #3C3F73",
+"* c #3B3D71",
+"= c #434475",
+"- c #8588A7",
+"; c #BFC4D6",
+"> c #E3E7EE",
+", c #F1F2F5",
+"' c #F6F7F9",
+") c #E0E6EF",
+"! c #C6D2E4",
+"~ c #A4B2CD",
+"{ c #6B739B",
+"] c #3E3F71",
+"^ c #393B6F",
+"/ c #3F4172",
+"( c #A0A6C0",
+"_ c #EAEEF2",
+": c #D6DDE5",
+"< c #D9DDE2",
+"[ c #FEFEFE",
+"} c #959BA2",
+"| c #BFD4EA",
+"1 c #C0D3E8",
+"2 c #C6D7EA",
+"3 c #C6D5E7",
+"4 c #7A86AB",
+"5 c #3D3E70",
+"6 c #3D3D71",
+"7 c #595B86",
+"8 c #EAECF0",
+"9 c #E8EBEE",
+"0 c #CACED3",
+"a c #C2CAD3",
+"b c #DAE8F6",
+"c c #FDFDFD",
+"d c #C5C7C8",
+"e c #8A9095",
+"f c #ABBAC9",
+"g c #BCD2EA",
+"h c #B4CBE6",
+"i c #ACC4E1",
+"j c #DEE5ED",
+"k c #EFF0F2",
+"l c #C6CCD8",
+"m c #4B4E7C",
+"n c #74779C",
+"o c #F1F2F4",
+"p c #B4BBC3",
+"q c #BEC9D5",
+"r c #C4CDD7",
+"s c #A4B0BC",
+"t c #D7E5F2",
+"u c #ACAEB1",
+"v c #AAB7C6",
+"w c #D0E1F4",
+"x c #B5C1CE",
+"y c #B6CAE0",
+"z c #B9CFE9",
+"A c #DFE6ED",
+"B c #CDD0D3",
+"C c #B5BDC5",
+"D c #E5E6E8",
+"E c #E8E9EC",
+"F c #5D6188",
+"G c #5A5D88",
+"H c #FBFBFC",
+"I c #C1CAD4",
+"J c #CAE0F6",
+"K c #FCFDFD",
+"L c #E2E3E5",
+"M c #D8E7F4",
+"N c #E0EFFE",
+"O c #D0DDEB",
+"P c #DAEAFA",
+"Q c #D5E5F7",
+"R c #CDE0F3",
+"S c #CBDEF1",
+"T c #C2CEDB",
+"U c #A9B6C4",
+"V c #939BA4",
+"W c #E5EAEE",
+"X c #F7F7F7",
+"Y c #EEEEEE",
+"Z c #E7E7E9",
+"` c #4C4E7A",
+" . c #454677",
+".. c #F1F2F3",
+"+. c #ECECED",
+"@. c #C3C4C6",
+"#. c #AFB5BD",
+"$. c #E2F0FF",
+"%. c #DFEDFC",
+"&. c #D8E8F9",
+"*. c #D0E2F5",
+"=. c #BFCEDF",
+"-. c #C3C9CF",
+";. c #FCFCFC",
+">. c #EFEFEF",
+",. c #E9E9E9",
+"'. c #D3D3D8",
+"). c #3D3F71",
+"!. c #A5A8C0",
+"~. c #FFFFFF",
+"{. c #D2D3D5",
+"]. c #ADB7C2",
+"^. c #CDDAE6",
+"/. c #E1F0FF",
+"(. c #DAEAFB",
+"_. c #D1E4F6",
+":. c #CEDFF3",
+"<. c #F0F1F3",
+"[. c #F4F5F5",
+"}. c #F8F9F9",
+"|. c #F2F2F2",
+"1. c #E5E5E5",
+"2. c #E6E6E6",
+"3. c #7D819A",
+"4. c #424475",
+"5. c #A3A6A8",
+"6. c #9FABB6",
+"7. c #D5E5F4",
+"8. c #E0EFFF",
+"9. c #DBEBFC",
+"0. c #D1E4F7",
+"a. c #EAEDF1",
+"b. c #C8CACD",
+"c. c #768697",
+"d. c #A9B1BA",
+"e. c #C2C5CA",
+"f. c #E3E4E5",
+"g. c #F4F4F4",
+"h. c #E7E7E7",
+"i. c #DDDDDD",
+"j. c #DCDCDD",
+"k. c #3C3E6E",
+"l. c #8689A7",
+"m. c #BBBDC0",
+"n. c #B4C5D6",
+"o. c #DEEEFF",
+"p. c #DFEEFF",
+"q. c #DFEFFF",
+"r. c #D9EAFB",
+"s. c #D0E3F6",
+"t. c #BCC6D2",
+"u. c #C6CBD1",
+"v. c #D6DEE7",
+"w. c #ABBED4",
+"x. c #869DB7",
+"y. c #819CB9",
+"z. c #A1AAB4",
+"A. c #E8E8E8",
+"B. c #DBDBDB",
+"C. c #E0E0E0",
+"D. c #626487",
+"E. c #3E4173",
+"F. c #CDCEDA",
+"G. c #CCCED0",
+"H. c #CDCFD1",
+"I. c #899CB0",
+"J. c #CCE2FB",
+"K. c #DCEDFF",
+"L. c #DDEDFE",
+"M. c #D5E7FA",
+"N. c #EFF2F4",
+"O. c #F0F1F2",
+"P. c #F3F5F6",
+"Q. c #DADFE5",
+"R. c #E3E6E9",
+"S. c #D3D3D4",
+"T. c #D4D5D5",
+"U. c #9A9BAB",
+"V. c #3A3D6F",
+"W. c #414476",
+"X. c #EFEFF3",
+"Y. c #818B96",
+"Z. c #88A2BE",
+"`. c #93A8C0",
+" + c #B6D0EB",
+".+ c #C4DDF7",
+"++ c #D0E6FC",
+"@+ c #DDEEFF",
+"#+ c #DCEDFE",
+"$+ c #D7E8FB",
+"%+ c #CFE3F7",
+"&+ c #E3E9F0",
+"*+ c #B0B5BA",
+"=+ c #C3C7CB",
+"-+ c #CFD0D0",
+";+ c #79899C",
+">+ c #A3A7B2",
+",+ c #37396B",
+"'+ c #3F4072",
+")+ c #F8F8FA",
+"!+ c #95A9C0",
+"~+ c #B2C8E0",
+"{+ c #A9C7E8",
+"]+ c #B2CFED",
+"^+ c #BBD6F2",
+"/+ c #C2DCF6",
+"(+ c #CCE2F9",
+"_+ c #D5E8FB",
+":+ c #D3E6FA",
+"<+ c #CEE2F7",
+"[+ c #C8DDF3",
+"}+ c #F7F8F8",
+"|+ c #92A1B2",
+"1+ c #D6D6D6",
+"2+ c #CBCBCB",
+"3+ c #8E9CAE",
+"4+ c #393B6E",
+"5+ c #3A3A6E",
+"6+ c #E0E3E8",
+"7+ c #ECEDEF",
+"8+ c #C7CCD1",
+"9+ c #9DBCDF",
+"0+ c #AAC8E9",
+"a+ c #B1CEED",
+"b+ c #B8D3F0",
+"c+ c #BCD6F3",
+"d+ c #C0D9F4",
+"e+ c #C5DCF4",
+"f+ c #C7DDF4",
+"g+ c #C4DBF2",
+"h+ c #C9DCF2",
+"i+ c #EBEBEB",
+"j+ c #969FA9",
+"k+ c #B2B7BC",
+"l+ c #535F6D",
+"m+ c #8CA1BB",
+"n+ c #39396D",
+"o+ c #3C3D70",
+"p+ c #CCD9EA",
+"q+ c #7D9AB9",
+"r+ c #A2ACB8",
+"s+ c #A6B7CB",
+"t+ c #E1E8F0",
+"u+ c #CBD4DD",
+"v+ c #C3D4E7",
+"w+ c #B0CDEC",
+"x+ c #B2CEED",
+"y+ c #AFCCEB",
+"z+ c #ACC9EA",
+"A+ c #A7C5E6",
+"B+ c #D4D8DC",
+"C+ c #F1F1F1",
+"D+ c #D1D1D2",
+"E+ c #B1B5BA",
+"F+ c #546F90",
+"G+ c #889EBD",
+"H+ c #B9C8DE",
+"I+ c #90B2D7",
+"J+ c #86ABD4",
+"K+ c #8DA2B8",
+"L+ c #F3F3F4",
+"M+ c #B8C9DC",
+"N+ c #A5C4E6",
+"O+ c #A3C2E5",
+"P+ c #9FBFE3",
+"Q+ c #99BBE0",
+"R+ c #91AFCF",
+"S+ c #BABEC3",
+"T+ c #949AA1",
+"U+ c #9FA6AD",
+"V+ c #F9F9F9",
+"W+ c #F5F5F5",
+"X+ c #EAEAEA",
+"Y+ c #DEDEDE",
+"Z+ c #D3D3D3",
+"`+ c #B3B5B6",
+" @ c #426083",
+".@ c #7C90B1",
+"+@ c #383A6E",
+"@@ c #3C3F71",
+"#@ c #96A7C6",
+"$@ c #9DB9DA",
+"%@ c #7EA5D0",
+"&@ c #C1D2E4",
+"*@ c #FBFBFB",
+"=@ c #B2C3D4",
+"-@ c #9BBCE0",
+";@ c #97B9DE",
+">@ c #93B6DC",
+",@ c #8FB2DA",
+"'@ c #89AED6",
+")@ c #799DC5",
+"!@ c #79A0CC",
+"~@ c #739CCA",
+"{@ c #EBEDEE",
+"]@ c #ECECEC",
+"^@ c #848484",
+"/@ c #393939",
+"(@ c #2D2D2D",
+"_@ c #0F1316",
+":@ c #161F29",
+"<@ c #4F5C7A",
+"[@ c #393A6C",
+"}@ c #646F99",
+"|@ c #B1C8E1",
+"1@ c #749DCB",
+"2@ c #D6DDE4",
+"3@ c #E8EAED",
+"4@ c #98B1CE",
+"5@ c #88ADD6",
+"6@ c #83A9D3",
+"7@ c #78A0CD",
+"8@ c #719AC9",
+"9@ c #6994C5",
+"0@ c #A4ADB8",
+"a@ c #707070",
+"b@ c #7B7B7B",
+"c@ c #D2D2D2",
+"d@ c #BBBBBB",
+"e@ c #707072",
+"f@ c #12121D",
+"g@ c #B2C6DF",
+"h@ c #779ECA",
+"i@ c #9DAEC0",
+"j@ c #FAFAFA",
+"k@ c #FBFCFC",
+"l@ c #6C7C90",
+"m@ c #7CA3CF",
+"n@ c #6D98C7",
+"o@ c #6792C4",
+"p@ c #5F8DC0",
+"q@ c #505A66",
+"r@ c #858585",
+"s@ c #BEBEBE",
+"t@ c #3F3F3F",
+"u@ c #1E1E1E",
+"v@ c #1C1D1E",
+"w@ c #4D4D4E",
+"x@ c #B1B1B1",
+"y@ c #6B7BA5",
+"z@ c #9EBAD9",
+"A@ c #6892C2",
+"B@ c #C0C4C9",
+"C@ c #F6F6F6",
+"D@ c #CED0D3",
+"E@ c #6589B1",
+"F@ c #709AC9",
+"G@ c #6C97C7",
+"H@ c #6893C4",
+"I@ c #638FC1",
+"J@ c #5C8ABE",
+"K@ c #5585BA",
+"L@ c #343638",
+"M@ c #C2C2C2",
+"N@ c #212121",
+"O@ c #BCBCBC",
+"P@ c #909295",
+"Q@ c #6C84A5",
+"R@ c #525E89",
+"S@ c #2E2E2E",
+"T@ c #AAAAAA",
+"U@ c #000000",
+"V@ c #3C3F72",
+"W@ c #9BB2D0",
+"X@ c #80A3CC",
+"Y@ c #5F88B6",
+"Z@ c #CED0D2",
+"`@ c #B4B8BB",
+" # c #6089B7",
+".# c #6490C2",
+"+# c #618EC0",
+"@# c #5D8ABE",
+"## c #5886BB",
+"$# c #5282B8",
+"%# c #4B7DB5",
+"&# c #2C2C2C",
+"*# c #C0C0C0",
+"=# c #191919",
+"-# c #989A9C",
+";# c #4C5E75",
+"># c #7385A5",
+",# c #393B6D",
+"'# c #161616",
+")# c #C1C0C0",
+"!# c #474B7C",
+"~# c #A1B9D5",
+"{# c #6E96C4",
+"]# c #B3BAC2",
+"^# c #9EA3A8",
+"/# c #48627E",
+"(# c #5A89BD",
+"_# c #5887BC",
+":# c #5584BA",
+"<# c #5181B8",
+"[# c #4C7EB5",
+"}# c #4779B2",
+"|# c #28486D",
+"1# c #141312",
+"2# c #9B9794",
+"3# c #201D1C",
+"4# c #0B0B07",
+"5# c #040302",
+"6# c #050403",
+"7# c #2F2921",
+"8# c #A8A39E",
+"9# c #1A130B",
+"0# c #2F335E",
+"a# c #4E5785",
+"b# c #9CB5D3",
+"c# c #A8B3C0",
+"d# c #CDCDCD",
+"e# c #CFCFCF",
+"f# c #687685",
+"g# c #4F80B7",
+"h# c #4E7FB6",
+"i# c #4C7DB5",
+"j# c #497BB3",
+"k# c #4678B1",
+"l# c #4175AF",
+"m# c #3E71AB",
+"n# c #A59176",
+"o# c #E0C4A0",
+"p# c #DFC4A3",
+"q# c #DABE9A",
+"r# c #D6BA94",
+"s# c #CDA676",
+"t# c #815A2B",
+"u# c #2E3058",
+"v# c #444977",
+"w# c #B4B9C4",
+"x# c #8F949A",
+"y# c #375A82",
+"z# c #4376B0",
+"A# c #4275AF",
+"B# c #4074AE",
+"C# c #3E72AC",
+"D# c #3E6FA9",
+"E# c #3D6CA4",
+"F# c #3C699F",
+"G# c #E2C5A1",
+"H# c #D8B58C",
+"I# c #CA9F68",
+"J# c #AC8758",
+"K# c #A78252",
+"L# c #A78253",
+"M# c #A37B4B",
+"N# c #BC8849",
+"O# c #AC712E",
+"P# c #202040",
+"Q# c #3A3B6D",
+"R# c #6E718E",
+"S# c #8697AD",
+"T# c #81A0C4",
+"U# c #648AB7",
+"V# c #4E79AC",
+"W# c #4672A6",
+"X# c #3E6BA0",
+"Y# c #446EA0",
+"Z# c #4C71A1",
+"`# c #5E7EA6",
+" $ c #E3C6A2",
+".$ c #D5AE7E",
+"+$ c #B08D5F",
+"@$ c #D5B284",
+"#$ c #CFAB7C",
+"$$ c #CFAC7B",
+"%$ c #CBA471",
+"&$ c #BC8746",
+"*$ c #AA6F2B",
+"=$ c #2A2B50",
+"-$ c #505985",
+";$ c #6D7FA6",
+">$ c #7E93B6",
+",$ c #869BBB",
+"'$ c #8AA1BE",
+")$ c #8297B6",
+"!$ c #798CAC",
+"~$ c #66759A",
+"{$ c #E1C4A0",
+"]$ c #D0A674",
+"^$ c #C79B64",
+"/$ c #AA8455",
+"($ c #A47E4E",
+"_$ c #A07744",
+":$ c #BA8442",
+"<$ c #1D1D37",
+"[$ c #2F3057",
+"}$ c #353765",
+"|$ c #363969",
+"1$ c #39396A",
+"2$ c #363768",
+"3$ c #343664",
+"4$ c #2E2F56",
+"5$ c #E1C29C",
+"6$ c #CEA470",
+"7$ c #AD8D64",
+"8$ c #D2B289",
+"9$ c #CDAC83",
+"0$ c #CEAD83",
+"a$ c #CCA77B",
+"b$ c #B8803E",
+"c$ c #AD7332",
+"d$ c #E0C29E",
+"e$ c #D4AC79",
+"f$ c #CDA66E",
+"g$ c #AF8D5E",
+"h$ c #AB8758",
+"i$ c #AB8858",
+"j$ c #A8814C",
+"k$ c #B47E3E",
+"l$ c #D0A874",
+"m$ c #C6965D",
+"n$ c #BE8D50",
+"o$ c #BA894B",
+"p$ c #BD8C4E",
+"q$ c #BC8A4C",
+"r$ c #BA8647",
+"s$ c #A47136",
+" ",
+" ",
+" . + @ # $ % & ",
+" * = - ; > , ' ) ! ~ { ] ^ ",
+" / ( _ : < [ [ [ } | 1 2 3 4 5 ",
+" 6 7 8 9 0 a b c d e f g h i j k l m ^ ",
+" n o p q r s t u v w x y z A B C D E F ",
+" G H I J K L M N O P Q R S T U V W X Y Z ` ",
+" ., [ [ ..+.@.#.$.$.%.&.*.=.-.;.[ [ ;.>.,.'.). ",
+" !.~.[ [ [ {.].^./././.(._.:.<.[.}.[ [ |.1.2.3. ",
+" 4.H [ [ c 5.6.7.8.8.8.8.9.0.a.b.c.d.e.f.g.h.i.j.k. ",
+" l.~.[ [ m.n.o.p.q.q.q.q.r.s.t.u.v.w.x.y.z.A.B.C.D. ",
+" E.F.;.G.H.I.J.K.o.o.o.o.L.M.s.N.[ [ O.P.Q.R.h.S.T.U.V. ",
+" W.X.Y.Z.`. +.+++@+@+@+#+$+%+&+[ [ [ [ [ [ *+=+-+;+>+,+ ",
+" '+)+!+~+{+]+^+/+(+_+_+:+<+[+}+[ [ [ [ [ ;.+.|+1+2+3+4+ ",
+" 5+6+7+8+9+0+a+b+c+d+e+f+g+h+[ [ [ [ [ [ X i+j+k+l+m+n+ ",
+" o+p+q+r+s+t+u+v+w+x+a+y+z+A+B+[ [ [ [ ;.C+1.D+E+F+G+4+ ",
+" & H+I+J+K+[ [ L+M+N+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@ ",
+" @@#@$@%@&@[ [ [ *@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@ ",
+" }@|@1@2@[ [ [ [ [ 3@4@5@6@%@7@8@9@0@a@b@c@B.B.d@e@f@ ",
+" $ g@h@i@j@[ [ [ [ k@l@m@7@~@n@o@p@q@r@s@t@u@v@w@x@^@ ",
+" y@z@A@B@|.C@V+j@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@R@S@T@U@ ",
+" V@W@X@Y@Z@A.i+]@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#U@ ",
+" !#~#{#]#B.i.^#/#(#_#:#<#[#}#|#1#2#3#4#5#5#6#7#8#9# ",
+" 0#a#b#c#d#e#f#g#h#i#j#k#l#m#U@n#o#p#p#q#q#q#r#s#t#U@",
+" u#v#w#1+x#y#z#A#B#C#D#E#F#U@G#H#I#J#K#K#L#M#N#O#U@",
+" P#Q#R#S#T#U#V#W#X#Y#Z#`#U@ $.$+$@$#$#$$$%$&$*$U@",
+" =$Q#-$;$>$,$'$)$!$~$U@{$]$^$/$($($($_$:$O#U@",
+" <$[$}$|$1$2$3$4$U@5$6$7$8$9$9$0$a$b$c$U@",
+" U@d$e$f$g$h$h$i$j$&$k$U@",
+" U@l$m$n$n$o$o$p$q$r$s$U@",
+" U@U@U@U@U@U@U@U@U@U@ "};
Added: trunk/gtk/src/icons/pkg-available.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-available.xpm?…
==============================================================================
--- trunk/gtk/src/icons/pkg-available.xpm (added)
+++ trunk/gtk/src/icons/pkg-available.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,505 @@
+/* XPM */
+static const char * pkg_available_xpm[] = {
+"32 32 470 2",
+" c None",
+". c #3E4174",
+"+ c #3F4275",
+"@ c #3D3E71",
+"# c #3A3B6C",
+"$ c #3C3E71",
+"% c #3E4074",
+"& c #3C3F73",
+"* c #3B3D71",
+"= c #434475",
+"- c #8588A7",
+"; c #BFC4D6",
+"> c #E3E7EE",
+", c #F1F2F5",
+"' c #F6F7F9",
+") c #E0E6EF",
+"! c #C6D2E4",
+"~ c #A4B2CD",
+"{ c #6B739B",
+"] c #3E3F71",
+"^ c #393B6F",
+"/ c #3F4172",
+"( c #A0A6C0",
+"_ c #EAEEF2",
+": c #D6DDE5",
+"< c #D9DDE2",
+"[ c #FEFEFE",
+"} c #959BA2",
+"| c #BFD4EA",
+"1 c #C0D3E8",
+"2 c #C6D7EA",
+"3 c #C6D5E7",
+"4 c #7A86AB",
+"5 c #3D3E70",
+"6 c #3D3D71",
+"7 c #595B86",
+"8 c #EAECF0",
+"9 c #E8EBEE",
+"0 c #CACED3",
+"a c #C2CAD3",
+"b c #DAE8F6",
+"c c #FDFDFD",
+"d c #C5C7C8",
+"e c #8A9095",
+"f c #ABBAC9",
+"g c #BCD2EA",
+"h c #B4CBE6",
+"i c #ACC4E1",
+"j c #DEE5ED",
+"k c #EFF0F2",
+"l c #C6CCD8",
+"m c #4B4E7C",
+"n c #74779C",
+"o c #F1F2F4",
+"p c #B4BBC3",
+"q c #BEC9D5",
+"r c #C4CDD7",
+"s c #A4B0BC",
+"t c #D7E5F2",
+"u c #ACAEB1",
+"v c #AAB7C6",
+"w c #D0E1F4",
+"x c #B5C1CE",
+"y c #B6CAE0",
+"z c #B9CFE9",
+"A c #DFE6ED",
+"B c #CDD0D3",
+"C c #B5BDC5",
+"D c #E5E6E8",
+"E c #E8E9EC",
+"F c #5D6188",
+"G c #5A5D88",
+"H c #FBFBFC",
+"I c #C1CAD4",
+"J c #CAE0F6",
+"K c #FCFDFD",
+"L c #E2E3E5",
+"M c #D8E7F4",
+"N c #E0EFFE",
+"O c #D0DDEB",
+"P c #DAEAFA",
+"Q c #D5E5F7",
+"R c #CDE0F3",
+"S c #CBDEF1",
+"T c #C2CEDB",
+"U c #A9B6C4",
+"V c #939BA4",
+"W c #E5EAEE",
+"X c #F7F7F7",
+"Y c #EEEEEE",
+"Z c #E7E7E9",
+"` c #4C4E7A",
+" . c #454677",
+".. c #F1F2F3",
+"+. c #ECECED",
+"@. c #C3C4C6",
+"#. c #AFB5BD",
+"$. c #E2F0FF",
+"%. c #DFEDFC",
+"&. c #D8E8F9",
+"*. c #D0E2F5",
+"=. c #BFCEDF",
+"-. c #C3C9CF",
+";. c #FCFCFC",
+">. c #EFEFEF",
+",. c #E9E9E9",
+"'. c #D3D3D8",
+"). c #3D3F71",
+"!. c #A5A8C0",
+"~. c #FFFFFF",
+"{. c #D2D3D5",
+"]. c #ADB7C2",
+"^. c #CDDAE6",
+"/. c #E1F0FF",
+"(. c #DAEAFB",
+"_. c #D1E4F6",
+":. c #CEDFF3",
+"<. c #F0F1F3",
+"[. c #F4F5F5",
+"}. c #F8F9F9",
+"|. c #F2F2F2",
+"1. c #E5E5E5",
+"2. c #E6E6E6",
+"3. c #7D819A",
+"4. c #424475",
+"5. c #A3A6A8",
+"6. c #9FABB6",
+"7. c #D5E5F4",
+"8. c #E0EFFF",
+"9. c #DBEBFC",
+"0. c #D1E4F7",
+"a. c #EAEDF1",
+"b. c #C8CACD",
+"c. c #768697",
+"d. c #A9B1BA",
+"e. c #C2C5CA",
+"f. c #E3E4E5",
+"g. c #F4F4F4",
+"h. c #E7E7E7",
+"i. c #DDDDDD",
+"j. c #DCDCDD",
+"k. c #3C3E6E",
+"l. c #8689A7",
+"m. c #BBBDC0",
+"n. c #B4C5D6",
+"o. c #DEEEFF",
+"p. c #DFEEFF",
+"q. c #DFEFFF",
+"r. c #D9EAFB",
+"s. c #D0E3F6",
+"t. c #BCC6D2",
+"u. c #C6CBD1",
+"v. c #D6DEE7",
+"w. c #ABBED4",
+"x. c #869DB7",
+"y. c #819CB9",
+"z. c #A1AAB4",
+"A. c #E8E8E8",
+"B. c #DBDBDB",
+"C. c #E0E0E0",
+"D. c #626487",
+"E. c #3E4173",
+"F. c #CDCEDA",
+"G. c #CCCED0",
+"H. c #CDCFD1",
+"I. c #899CB0",
+"J. c #CCE2FB",
+"K. c #DCEDFF",
+"L. c #DDEDFE",
+"M. c #D5E7FA",
+"N. c #EFF2F4",
+"O. c #F0F1F2",
+"P. c #F3F5F6",
+"Q. c #DADFE5",
+"R. c #E3E6E9",
+"S. c #D3D3D4",
+"T. c #D4D5D5",
+"U. c #9A9BAB",
+"V. c #3A3D6F",
+"W. c #414476",
+"X. c #EFEFF3",
+"Y. c #818B96",
+"Z. c #88A2BE",
+"`. c #93A8C0",
+" + c #B6D0EB",
+".+ c #C4DDF7",
+"++ c #D0E6FC",
+"@+ c #DDEEFF",
+"#+ c #DCEDFE",
+"$+ c #D7E8FB",
+"%+ c #CFE3F7",
+"&+ c #E3E9F0",
+"*+ c #B0B5BA",
+"=+ c #C3C7CB",
+"-+ c #CFD0D0",
+";+ c #79899C",
+">+ c #A3A7B2",
+",+ c #37396B",
+"'+ c #3F4072",
+")+ c #F8F8FA",
+"!+ c #95A9C0",
+"~+ c #B2C8E0",
+"{+ c #A9C7E8",
+"]+ c #B2CFED",
+"^+ c #BBD6F2",
+"/+ c #C2DCF6",
+"(+ c #CCE2F9",
+"_+ c #D5E8FB",
+":+ c #D3E6FA",
+"<+ c #CEE2F7",
+"[+ c #C8DDF3",
+"}+ c #F7F8F8",
+"|+ c #92A1B2",
+"1+ c #D6D6D6",
+"2+ c #CBCBCB",
+"3+ c #8E9CAE",
+"4+ c #393B6E",
+"5+ c #3A3A6E",
+"6+ c #E0E3E8",
+"7+ c #ECEDEF",
+"8+ c #C7CCD1",
+"9+ c #9DBCDF",
+"0+ c #AAC8E9",
+"a+ c #B1CEED",
+"b+ c #B8D3F0",
+"c+ c #BCD6F3",
+"d+ c #C0D9F4",
+"e+ c #C5DCF4",
+"f+ c #C7DDF4",
+"g+ c #C4DBF2",
+"h+ c #C9DCF2",
+"i+ c #EBEBEB",
+"j+ c #969FA9",
+"k+ c #B2B7BC",
+"l+ c #535F6D",
+"m+ c #8CA1BB",
+"n+ c #39396D",
+"o+ c #3C3D70",
+"p+ c #CCD9EA",
+"q+ c #7D9AB9",
+"r+ c #A2ACB8",
+"s+ c #A6B7CB",
+"t+ c #E1E8F0",
+"u+ c #CBD4DD",
+"v+ c #C3D4E7",
+"w+ c #B0CDEC",
+"x+ c #B2CEED",
+"y+ c #AFCCEB",
+"z+ c #ACC9EA",
+"A+ c #A7C5E6",
+"B+ c #D4D8DC",
+"C+ c #F1F1F1",
+"D+ c #D1D1D2",
+"E+ c #B1B5BA",
+"F+ c #546F90",
+"G+ c #889EBD",
+"H+ c #B9C8DE",
+"I+ c #90B2D7",
+"J+ c #86ABD4",
+"K+ c #8DA2B8",
+"L+ c #F3F3F4",
+"M+ c #B8C9DC",
+"N+ c #A5C4E6",
+"O+ c #A3C2E5",
+"P+ c #9FBFE3",
+"Q+ c #99BBE0",
+"R+ c #91AFCF",
+"S+ c #BABEC3",
+"T+ c #949AA1",
+"U+ c #9FA6AD",
+"V+ c #F9F9F9",
+"W+ c #F5F5F5",
+"X+ c #EAEAEA",
+"Y+ c #DEDEDE",
+"Z+ c #D3D3D3",
+"`+ c #B3B5B6",
+" @ c #426083",
+".@ c #7C90B1",
+"+@ c #383A6E",
+"@@ c #3C3F71",
+"#@ c #96A7C6",
+"$@ c #9DB9DA",
+"%@ c #7EA5D0",
+"&@ c #C1D2E4",
+"*@ c #FBFBFB",
+"=@ c #B2C3D4",
+"-@ c #9BBCE0",
+";@ c #97B9DE",
+">@ c #93B6DC",
+",@ c #8FB2DA",
+"'@ c #89AED6",
+")@ c #799DC5",
+"!@ c #79A0CC",
+"~@ c #739CCA",
+"{@ c #EBEDEE",
+"]@ c #ECECEC",
+"^@ c #E2E2E2",
+"/@ c #D7D7D7",
+"(@ c #CCCCCC",
+"_@ c #475566",
+":@ c #5E80A9",
+"<@ c #68789F",
+"[@ c #3A3B6D",
+"}@ c #646F99",
+"|@ c #B1C8E1",
+"1@ c #749DCB",
+"2@ c #D6DDE4",
+"3@ c #E8EAED",
+"4@ c #98B1CE",
+"5@ c #88ADD6",
+"6@ c #83A9D3",
+"7@ c #78A0CD",
+"8@ c #719AC9",
+"9@ c #6994C5",
+"0@ c #AFB9C5",
+"a@ c #E3E3E3",
+"b@ c #D9D9D9",
+"c@ c #CECECE",
+"d@ c #A2A5A8",
+"e@ c #325784",
+"f@ c #7691B3",
+"g@ c #4E5682",
+"h@ c #B2C6DF",
+"i@ c #779ECA",
+"j@ c #9DAEC0",
+"k@ c #FAFAFA",
+"l@ c #FBFCFC",
+"m@ c #6C7C90",
+"n@ c #7CA3CF",
+"o@ c #6D98C7",
+"p@ c #6792C4",
+"q@ c #5F8DC0",
+"r@ c #8DA1B8",
+"s@ c #CFCFCF",
+"t@ c #C5C5C5",
+"u@ c #93969A",
+"v@ c #446897",
+"w@ c #7C92B1",
+"x@ c #3B3C6E",
+"y@ c #6B7BA5",
+"z@ c #9EBAD9",
+"A@ c #6892C2",
+"B@ c #C0C4C9",
+"C@ c #F6F6F6",
+"D@ c #CED0D3",
+"E@ c #6589B1",
+"F@ c #709AC9",
+"G@ c #6C97C7",
+"H@ c #6893C4",
+"I@ c #638FC1",
+"J@ c #5C8ABE",
+"K@ c #5585BA",
+"L@ c #92A7BE",
+"M@ c #BCBCBC",
+"N@ c #909295",
+"O@ c #6C84A5",
+"P@ c #525E89",
+"Q@ c #3C3F72",
+"R@ c #9BB2D0",
+"S@ c #80A3CC",
+"T@ c #5F88B6",
+"U@ c #CED0D2",
+"V@ c #B4B8BB",
+"W@ c #6089B7",
+"X@ c #6490C2",
+"Y@ c #618EC0",
+"Z@ c #5D8ABE",
+"`@ c #5886BB",
+" # c #5282B8",
+".# c #4B7DB5",
+"+# c #889AAF",
+"@# c #C3C3C3",
+"## c #BBBBBB",
+"$# c #989A9C",
+"%# c #4C5E75",
+"&# c #7385A5",
+"*# c #393B6D",
+"=# c #474B7C",
+"-# c #A1B9D5",
+";# c #6E96C4",
+"># c #B3BAC2",
+",# c #9EA3A8",
+"'# c #48627E",
+")# c #5A89BD",
+"!# c #5887BC",
+"~# c #5584BA",
+"{# c #5181B8",
+"]# c #4C7EB5",
+"^# c #4779B2",
+"/# c #4174AF",
+"(# c #597DA6",
+"_# c #B8B8B8",
+":# c #B0B0B0",
+"<# c #898B8F",
+"[# c #798BA8",
+"}# c #3F4371",
+"|# c #2F335E",
+"1# c #4E5785",
+"2# c #9CB5D3",
+"3# c #A8B3C0",
+"4# c #CDCDCD",
+"5# c #687685",
+"6# c #4F80B7",
+"7# c #4E7FB6",
+"8# c #4C7DB5",
+"9# c #497BB3",
+"0# c #4678B1",
+"a# c #4175AF",
+"b# c #3E71AB",
+"c# c #3D6DA5",
+"d# c #3D699E",
+"e# c #A4A5A7",
+"f# c #ACADAD",
+"g# c #7B8392",
+"h# c #464B78",
+"i# c #2C2D56",
+"j# c #2E3058",
+"k# c #444977",
+"l# c #B4B9C4",
+"m# c #8F949A",
+"n# c #375A82",
+"o# c #4376B0",
+"p# c #4275AF",
+"q# c #4074AE",
+"r# c #3E72AC",
+"s# c #3E6FA9",
+"t# c #3D6CA4",
+"u# c #3C699F",
+"v# c #3B6599",
+"w# c #496D9B",
+"x# c #7D8899",
+"y# c #6D788E",
+"z# c #2A2B51",
+"A# c #202040",
+"B# c #6E718E",
+"C# c #8697AD",
+"D# c #81A0C4",
+"E# c #648AB7",
+"F# c #4E79AC",
+"G# c #4672A6",
+"H# c #3E6BA0",
+"I# c #446EA0",
+"J# c #4C71A1",
+"K# c #5E7EA6",
+"L# c #758DAF",
+"M# c #7E91B0",
+"N# c #565E87",
+"O# c #38396B",
+"P# c #1D1D38",
+"Q# c #2A2B50",
+"R# c #505985",
+"S# c #6D7FA6",
+"T# c #7E93B6",
+"U# c #869BBB",
+"V# c #8AA1BE",
+"W# c #8297B6",
+"X# c #798CAC",
+"Y# c #66759A",
+"Z# c #4B517C",
+"`# c #3A3B6B",
+" $ c #292A4D",
+".$ c #1D1D37",
+"+$ c #2F3057",
+"@$ c #353765",
+"#$ c #363969",
+"$$ c #39396A",
+"%$ c #363768",
+"&$ c #343664",
+"*$ c #2E2F56",
+"=$ c #1B1B35",
+" ",
+" ",
+" . + @ # $ % & ",
+" * = - ; > , ' ) ! ~ { ] ^ ",
+" / ( _ : < [ [ [ } | 1 2 3 4 5 ",
+" 6 7 8 9 0 a b c d e f g h i j k l m ^ ",
+" n o p q r s t u v w x y z A B C D E F ",
+" G H I J K L M N O P Q R S T U V W X Y Z ` ",
+" ., [ [ ..+.@.#.$.$.%.&.*.=.-.;.[ [ ;.>.,.'.). ",
+" !.~.[ [ [ {.].^./././.(._.:.<.[.}.[ [ |.1.2.3. ",
+" 4.H [ [ c 5.6.7.8.8.8.8.9.0.a.b.c.d.e.f.g.h.i.j.k. ",
+" l.~.[ [ m.n.o.p.q.q.q.q.r.s.t.u.v.w.x.y.z.A.B.C.D. ",
+" E.F.;.G.H.I.J.K.o.o.o.o.L.M.s.N.[ [ O.P.Q.R.h.S.T.U.V. ",
+" W.X.Y.Z.`. +.+++@+@+@+#+$+%+&+[ [ [ [ [ [ *+=+-+;+>+,+ ",
+" '+)+!+~+{+]+^+/+(+_+_+:+<+[+}+[ [ [ [ [ ;.+.|+1+2+3+4+ ",
+" 5+6+7+8+9+0+a+b+c+d+e+f+g+h+[ [ [ [ [ [ X i+j+k+l+m+n+ ",
+" o+p+q+r+s+t+u+v+w+x+a+y+z+A+B+[ [ [ [ ;.C+1.D+E+F+G+4+ ",
+" & H+I+J+K+[ [ L+M+N+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@ ",
+" @@#@$@%@&@[ [ [ *@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@ ",
+" }@|@1@2@[ [ [ [ [ 3@4@5@6@%@7@8@9@0@a@b@c@d@e@f@g@ ",
+" $ h@i@j@k@[ [ [ [ l@m@n@7@~@o@p@q@r@b@s@t@u@v@w@x@ ",
+" y@z@A@B@|.C@V+k@D@E@F@G@H@I@J@K@L@c@t@M@N@O@P@ ",
+" Q@R@S@T@U@A.i+]@V@W@X@Y@Z@`@ #.#+#@###$#%#&#*# ",
+" =#-#;#>#B.i.,#'#)#!#~#{#]#^#/#(#_#:#<#[#}# ",
+" |#1#2#3#4#s@5#6#7#8#9#0#a#b#c#d#e#f#g#h#i# ",
+" j#k#l#1+m#n#o#p#q#r#s#t#u#v#w#x#y#}#z# ",
+" A#[@B#C#D#E#F#G#H#I#J#K#L#M#N#O#P# ",
+" Q#[@R#S#T#U#V#W#X#Y#Z#`# $ ",
+" .$+$@$#$$$%$&$*$=$ ",
+" ",
+" ",
+" "};
Added: trunk/gtk/src/icons/pkg-install-auto.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-install-auto.x…
==============================================================================
--- trunk/gtk/src/icons/pkg-install-auto.xpm (added)
+++ trunk/gtk/src/icons/pkg-install-auto.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,325 @@
+/* XPM */
+static const char * pkg_install_auto_xpm[] = {
+"32 32 290 2",
+" c None",
+". c #1F4B8A",
+"+ c #214C89",
+"@ c #214C8A",
+"# c #214D8A",
+"$ c #204A88",
+"% c #204B88",
+"& c #2B558F",
+"* c #5B80AF",
+"= c #7998C0",
+"- c #89A6C9",
+"; c #85A2C6",
+"> c #698AB5",
+", c #355D95",
+"' c #1F4C89",
+") c #5377A7",
+"! c #8AA5CA",
+"~ c #8BA7CB",
+"{ c #90ABCE",
+"] c #93ADCE",
+"^ c #96AFD0",
+"/ c #98B1D1",
+"( c #99B2D1",
+"_ c #6C8CB6",
+": c #234E89",
+"< c #1F4987",
+"[ c #5B7CAA",
+"} c #5B7CAB",
+"| c #41669C",
+"1 c #446BA0",
+"2 c #6283B2",
+"3 c #90ABCD",
+"4 c #93ADCF",
+"5 c #8CA7CC",
+"6 c #8AA6CB",
+"7 c #94ADCF",
+"8 c #7C99C1",
+"9 c #325A91",
+"0 c #2D558F",
+"a c #1F4C87",
+"b c #214C88",
+"c c #315891",
+"d c #86A2C7",
+"e c #8DA9CC",
+"f c #84A1C8",
+"g c #809FC6",
+"h c #6587B3",
+"i c #204B8B",
+"j c #224C88",
+"k c #325C93",
+"l c #7F9EC6",
+"m c #7B9BC4",
+"n c #7A9AC3",
+"o c #91ACCE",
+"p c #305991",
+"q c #1E4A86",
+"r c #204A8A",
+"s c #6A8BB7",
+"t c #83A1C8",
+"u c #7697C2",
+"v c #7395C1",
+"w c #86A3C9",
+"x c #6183B1",
+"y c #1F4A87",
+"z c #545454",
+"A c #595959",
+"B c #5C5C5C",
+"C c #4D5766",
+"D c #446798",
+"E c #89A5CB",
+"F c #7193BF",
+"G c #6D90BE",
+"H c #7797C2",
+"I c #7F9DC4",
+"J c #284E83",
+"K c #5B5B5B",
+"L c #585858",
+"M c #535353",
+"N c #AFAFAF",
+"O c #FCFCFC",
+"P c #FEFEFE",
+"Q c #FDFDFD",
+"R c #F0F2F5",
+"S c #6B8FBD",
+"T c #698DBC",
+"U c #6A8EBD",
+"V c #8EA9CC",
+"W c #2A528D",
+"X c #F6F6F6",
+"Y c #F5F5F5",
+"Z c #F4F4F4",
+"` c #F3F3F3",
+" . c #F2F2F2",
+".. c #959595",
+"+. c #AFBCCE",
+"@. c #8CA8CC",
+"#. c #658ABA",
+"$. c #6388B9",
+"%. c #6187B8",
+"&. c #95AECF",
+"*. c #6F89AD",
+"=. c #DEDEDE",
+"-. c #979797",
+";. c #F8F8F8",
+">. c #E5E5E5",
+",. c #9CADC3",
+"'. c #385E95",
+"). c #7A99C2",
+"!. c #8DA8CC",
+"~. c #5F85B8",
+"{. c #5D84B7",
+"]. c #5B82B6",
+"^. c #94AFCF",
+"/. c #97B0D0",
+"(. c #6182B0",
+"_. c #486A9B",
+":. c #D9DADB",
+"<. c #EDEDED",
+"[. c #7E7E7E",
+"}. c #DFDFDF",
+"|. c #ECECEC",
+"1. c #E0E0E0",
+"2. c #E3E3E3",
+"3. c #869BB9",
+"4. c #3A6198",
+"5. c #7B9AC3",
+"6. c #5A82B5",
+"7. c #5981B5",
+"8. c #5880B4",
+"9. c #4E79B0",
+"0. c #4370AB",
+"a. c #3969A7",
+"b. c #6C8FBE",
+"c. c #6889B6",
+"d. c #345A90",
+"e. c #CACDD2",
+"f. c #D7D7D7",
+"g. c #E2E2E2",
+"h. c #C3C3C3",
+"i. c #696969",
+"j. c #FAFAFA",
+"k. c #E1E1E1",
+"l. c #E4E4E4",
+"m. c #E7E7E7",
+"n. c #6C87AC",
+"o. c #42699C",
+"p. c #7B9BC3",
+"q. c #5881B5",
+"r. c #4A76AE",
+"s. c #416EAA",
+"t. c #3666A5",
+"u. c #3364A4",
+"v. c #5C83B6",
+"w. c #7493BE",
+"x. c #2D568F",
+"y. c #BBC3CE",
+"z. c #DCDCDC",
+"A. c #D9D9D9",
+"B. c #E9E9E9",
+"C. c #5F5F5F",
+"D. c #BDBDBD",
+"E. c #F0F0F0",
+"F. c #E0E1E2",
+"G. c #5A78A3",
+"H. c #426A9F",
+"I. c #3A69A7",
+"J. c #4D78B0",
+"K. c #7D9CC4",
+"L. c #315992",
+"M. c #A2B0C2",
+"N. c #DBDBDB",
+"O. c #DADADA",
+"P. c #D8D8D8",
+"Q. c #A2A2A2",
+"R. c #555555",
+"S. c #DDDDDD",
+"T. c #D8D9DA",
+"U. c #486A9A",
+"V. c #476EA2",
+"W. c #6F92BF",
+"X. c #416FAA",
+"Y. c #82A0C7",
+"Z. c #3C6298",
+"`. c #7E93B1",
+" + c #919191",
+".+ c #D6D6D6",
+"++ c #CCCED2",
+"@+ c #395E93",
+"#+ c #557AAC",
+"$+ c #7092BF",
+"%+ c #3D6CA9",
+"&+ c #7E9DC6",
+"*+ c #4A70A2",
+"=+ c #58769F",
+"-+ c #D0D0D0",
+";+ c #D1D1D1",
+">+ c #D2D2D2",
+",+ c #D4D4D4",
+"'+ c #7F7F7F",
+")+ c #D5D5D5",
+"!+ c #BABFC6",
+"~+ c #2F578E",
+"{+ c #5E82B1",
+"]+ c #89A5CA",
+"^+ c #597CAD",
+"/+ c #3C6093",
+"(+ c #C1C3C5",
+"_+ c #CACACA",
+":+ c #CCCCCC",
+"<+ c #CDCDCD",
+"[+ c #676767",
+"}+ c #CECECE",
+"|+ c #C8C8C8",
+"1+ c #AEB4BD",
+"2+ c #2B538C",
+"3+ c #4D72A6",
+"4+ c #2B548D",
+"5+ c #B0B5BB",
+"6+ c #C4C4C4",
+"7+ c #C6C6C6",
+"8+ c #D3D3D3",
+"9+ c #626262",
+"0+ c #B6B6B6",
+"a+ c #EBEBEB",
+"b+ c #CFCFCF",
+"c+ c #CBCBCB",
+"d+ c #A2ABB8",
+"e+ c #9D9D9D",
+"f+ c #555753",
+"g+ c #575955",
+"h+ c #CDD0D5",
+"i+ c #575757",
+"j+ c #DBDCDA",
+"k+ c #BABBB9",
+"l+ c #585A56",
+"m+ c #E8E8E8",
+"n+ c #DCDDDB",
+"o+ c #BBBCBA",
+"p+ c #595B57",
+"q+ c #B7B7B7",
+"r+ c #5A5C58",
+"s+ c #B0B0B0",
+"t+ c #B4B4B4",
+"u+ c #B3B3B3",
+"v+ c #B2B2B2",
+"w+ c #B1B1B1",
+"x+ c #AEAEAE",
+"y+ c #ADADAD",
+"z+ c #ACACAC",
+"A+ c #ABABAB",
+"B+ c #AAAAAA",
+"C+ c #A8A8A8",
+"D+ c #A7A7A7",
+"E+ c #A6A6A6",
+"F+ c #A5A5A5",
+"G+ c #A4A4A4",
+"H+ c #A1A1A1",
+"I+ c #A0A0A0",
+"J+ c #9F9F9F",
+"K+ c #B9B9B9",
+"L+ c #565854",
+"M+ c #DDDEDC",
+"N+ c #989898",
+"O+ c #C5C5C5",
+"P+ c #949494",
+"Q+ c #C2C2C2",
+"R+ c #929292",
+"S+ c #C1C1C1",
+"T+ c #909090",
+"U+ c #BFBFBF",
+"V+ c #DCDDDA",
+"W+ c #C0C1BF",
+"X+ c #C1C2C0",
+"Y+ c #969696",
+"Z+ c #C0C0C0",
+"`+ c #8F8F8F",
+" @ c #C4C5C3",
+".@ c #C3C4C2",
+"+@ c #A9A9A9",
+"@@ c #939393",
+"#@ c #CCCDCB",
+"$@ c #525252",
+"%@ c #D4D5D3",
+"&@ c #C9C9C9",
+"*@ c #C7C7C7",
+"=@ c #BBBBBB",
+"-@ c #515151",
+";@ c #D7D8D6",
+">@ c #505050",
+",@ c #D3D4D2",
+" ",
+" . + @ # $ ",
+" % & * = - ; > , ' ",
+" % ) ! ~ { ] ^ / ( _ : ",
+" < [ } | 1 2 3 4 5 6 7 8 # ",
+" 9 0 a b c d e f g 3 h i ",
+" < j k 3 l m n o p ",
+" q r s t u v w x y ",
+" z A B B B B C D E F G H I J B K K K L M ",
+" M N O P Q Q O R c ~ S T U V W X Y Z ` ... ",
+" z Y +.y y y y y : @.#.$.%.&.y y y y y *.=.M ",
+" -.;.>.,.'.).t w 6 !.~.{.].^./.( / (._.:.<.[. ",
+" M }.|.1.2.3.4.5.#.].6.7.8.9.0.a.b.c.d.e.f.g.h.M ",
+" i.j.k.l.m.m.n.o.p.q.r.s.t.u.u.v.w.x.y.z.A.A.B.C. ",
+" z D.E.k.>.>.l.F.G.H.U I.u.u.u.J.K.L.M.z.N.O.P.l.Q. ",
+" R.E.l.>.l.g.1.S.T.U.V.W.a.u.X.Y.Z.`.P.A.O.O.O.O.P.M ",
+" +Y z.m.1.z.A..+.+++@+#+$+%+&+*+=+-+;+>+,+.+=.,+>.'+ ",
+" M P.m.z.2.}..+)+)+,+;+!+~+{+]+^+/+(+_+:+<+-+P.N.>+N.D.z ",
+" [+Y z.A.f.}.}.f.,+;+}+|+1+2+3+4+5+6+7+_+<+P.A.<+-+8+1.9+ ",
+" 0+a+P.f.f..+O.g.=.f.b+c+|+d+y d+7+_+-+f.O.>+}+b+>+P.S.e+ ",
+" M B.1.f+g+f+f+>+)+.+A.z.z.N.O.h+A.N.A.f.-+}+b+;+8+g.X O.8+i+ ",
+" M X z.g+j+k+l+.+z.N.A.P.f..+,+,+,+)+.+f.f.P.P.P.f..+f.)+m+R. ",
+" M E.1.g+n+o+p+P.}.=.S.S.S.z.z.N.N.O.O.O.A.P.f.f..+.+)+)+-+M ",
+" M B.q+f+n+o+r+s+t+u+v+w+N x+y+z+A+B+C+D+E+F+G+Q.H+I+J+J+K+M ",
+"f+f+f+L+r+M+o+p+f+f+f+f+B+z+y+x+A+B+N+O+-.h.P+Q+R+S+T+U+J+q+M ",
+"f+V+n+M+n+n+W+W+W+W+X+f+B+A+y+y+A+B+N+O+Y+h.P+Q+ +Z+`+U+J+t+M ",
+"f+j+ @.@.@.@.@.@.@.@.@f+B+A+y+z+B++@N+O+Y+h.@@S+ +Z+`+U+J+v+M ",
+"f+f+f+f+f+#@#@l+f+f+f+f+y+B+z+z+B++@-.6+..h.@@S+T+U+`+U+I+x+M ",
+" $@O+k.f+%@%@l+)+f.)+8+;+b+<+c+&@*@6+Q+U+D.=@K+0+t+v+w+N ..-@ ",
+" -@M f+;@;@L+M M M M M M M M M M M M M M M M M M M M M >@ ",
+" f+,@,@g+ ",
+" L+g+g+L+ "};
Added: trunk/gtk/src/icons/pkg-install.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-install.xpm?re…
==============================================================================
--- trunk/gtk/src/icons/pkg-install.xpm (added)
+++ trunk/gtk/src/icons/pkg-install.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,318 @@
+/* XPM */
+static const char * pkg_install_xpm[] = {
+"32 32 283 2",
+" c None",
+". c #1F4B8A",
+"+ c #214C89",
+"@ c #214C8A",
+"# c #214D8A",
+"$ c #204A88",
+"% c #204B88",
+"& c #2B558F",
+"* c #5B80AF",
+"= c #7998C0",
+"- c #89A6C9",
+"; c #85A2C6",
+"> c #698AB5",
+", c #355D95",
+"' c #1F4C89",
+") c #5377A7",
+"! c #8AA5CA",
+"~ c #8BA7CB",
+"{ c #90ABCE",
+"] c #93ADCE",
+"^ c #96AFD0",
+"/ c #98B1D1",
+"( c #99B2D1",
+"_ c #6C8CB6",
+": c #234E89",
+"< c #1F4987",
+"[ c #5B7CAA",
+"} c #5B7CAB",
+"| c #41669C",
+"1 c #446BA0",
+"2 c #6283B2",
+"3 c #90ABCD",
+"4 c #93ADCF",
+"5 c #8CA7CC",
+"6 c #8AA6CB",
+"7 c #94ADCF",
+"8 c #7C99C1",
+"9 c #325A91",
+"0 c #2D558F",
+"a c #1F4C87",
+"b c #214C88",
+"c c #315891",
+"d c #86A2C7",
+"e c #8DA9CC",
+"f c #84A1C8",
+"g c #809FC6",
+"h c #6587B3",
+"i c #204B8B",
+"j c #224C88",
+"k c #325C93",
+"l c #7F9EC6",
+"m c #7B9BC4",
+"n c #7A9AC3",
+"o c #91ACCE",
+"p c #305991",
+"q c #1E4A86",
+"r c #204A8A",
+"s c #6A8BB7",
+"t c #83A1C8",
+"u c #7697C2",
+"v c #7395C1",
+"w c #86A3C9",
+"x c #6183B1",
+"y c #1F4A87",
+"z c #545454",
+"A c #595959",
+"B c #5C5C5C",
+"C c #4D5766",
+"D c #446798",
+"E c #89A5CB",
+"F c #7193BF",
+"G c #6D90BE",
+"H c #7797C2",
+"I c #7F9DC4",
+"J c #284E83",
+"K c #5B5B5B",
+"L c #585858",
+"M c #535353",
+"N c #AFAFAF",
+"O c #FCFCFC",
+"P c #FEFEFE",
+"Q c #FDFDFD",
+"R c #F0F2F5",
+"S c #6B8FBD",
+"T c #698DBC",
+"U c #6A8EBD",
+"V c #8EA9CC",
+"W c #2A528D",
+"X c #F6F6F6",
+"Y c #F5F5F5",
+"Z c #F4F4F4",
+"` c #F3F3F3",
+" . c #F2F2F2",
+".. c #959595",
+"+. c #AFBCCE",
+"@. c #8CA8CC",
+"#. c #658ABA",
+"$. c #6388B9",
+"%. c #6187B8",
+"&. c #95AECF",
+"*. c #6F89AD",
+"=. c #DEDEDE",
+"-. c #979797",
+";. c #F8F8F8",
+">. c #E5E5E5",
+",. c #9CADC3",
+"'. c #385E95",
+"). c #7A99C2",
+"!. c #8DA8CC",
+"~. c #5F85B8",
+"{. c #5D84B7",
+"]. c #5B82B6",
+"^. c #94AFCF",
+"/. c #97B0D0",
+"(. c #6182B0",
+"_. c #486A9B",
+":. c #D9DADB",
+"<. c #EDEDED",
+"[. c #7E7E7E",
+"}. c #DFDFDF",
+"|. c #ECECEC",
+"1. c #E0E0E0",
+"2. c #E3E3E3",
+"3. c #869BB9",
+"4. c #3A6198",
+"5. c #7B9AC3",
+"6. c #5A82B5",
+"7. c #5981B5",
+"8. c #5880B4",
+"9. c #4E79B0",
+"0. c #4370AB",
+"a. c #3969A7",
+"b. c #6C8FBE",
+"c. c #6889B6",
+"d. c #345A90",
+"e. c #CACDD2",
+"f. c #D7D7D7",
+"g. c #E2E2E2",
+"h. c #C3C3C3",
+"i. c #696969",
+"j. c #FAFAFA",
+"k. c #E1E1E1",
+"l. c #E4E4E4",
+"m. c #E7E7E7",
+"n. c #6C87AC",
+"o. c #42699C",
+"p. c #7B9BC3",
+"q. c #5881B5",
+"r. c #4A76AE",
+"s. c #416EAA",
+"t. c #3666A5",
+"u. c #3364A4",
+"v. c #5C83B6",
+"w. c #7493BE",
+"x. c #2D568F",
+"y. c #BBC3CE",
+"z. c #DCDCDC",
+"A. c #D9D9D9",
+"B. c #E9E9E9",
+"C. c #5F5F5F",
+"D. c #BDBDBD",
+"E. c #F0F0F0",
+"F. c #E0E1E2",
+"G. c #5A78A3",
+"H. c #426A9F",
+"I. c #3A69A7",
+"J. c #4D78B0",
+"K. c #7D9CC4",
+"L. c #315992",
+"M. c #A2B0C2",
+"N. c #DBDBDB",
+"O. c #DADADA",
+"P. c #D8D8D8",
+"Q. c #A2A2A2",
+"R. c #555555",
+"S. c #DDDDDD",
+"T. c #D8D9DA",
+"U. c #486A9A",
+"V. c #476EA2",
+"W. c #6F92BF",
+"X. c #416FAA",
+"Y. c #82A0C7",
+"Z. c #3C6298",
+"`. c #7E93B1",
+" + c #919191",
+".+ c #D6D6D6",
+"++ c #CCCED2",
+"@+ c #395E93",
+"#+ c #557AAC",
+"$+ c #7092BF",
+"%+ c #3D6CA9",
+"&+ c #7E9DC6",
+"*+ c #4A70A2",
+"=+ c #58769F",
+"-+ c #D0D0D0",
+";+ c #D1D1D1",
+">+ c #D2D2D2",
+",+ c #D4D4D4",
+"'+ c #7F7F7F",
+")+ c #D5D5D5",
+"!+ c #BABFC6",
+"~+ c #2F578E",
+"{+ c #5E82B1",
+"]+ c #89A5CA",
+"^+ c #597CAD",
+"/+ c #3C6093",
+"(+ c #C1C3C5",
+"_+ c #CACACA",
+":+ c #CCCCCC",
+"<+ c #CDCDCD",
+"[+ c #676767",
+"}+ c #CECECE",
+"|+ c #C8C8C8",
+"1+ c #AEB4BD",
+"2+ c #2B538C",
+"3+ c #4D72A6",
+"4+ c #2B548D",
+"5+ c #B0B5BB",
+"6+ c #C4C4C4",
+"7+ c #C6C6C6",
+"8+ c #D3D3D3",
+"9+ c #626262",
+"0+ c #B6B6B6",
+"a+ c #EBEBEB",
+"b+ c #CFCFCF",
+"c+ c #CBCBCB",
+"d+ c #A2ABB8",
+"e+ c #9D9D9D",
+"f+ c #F7F7F7",
+"g+ c #CDD0D5",
+"h+ c #575757",
+"i+ c #E8E8E8",
+"j+ c #BABABA",
+"k+ c #B9B9B9",
+"l+ c #B8B8B8",
+"m+ c #B7B7B7",
+"n+ c #B5B5B5",
+"o+ c #B4B4B4",
+"p+ c #B3B3B3",
+"q+ c #B2B2B2",
+"r+ c #B1B1B1",
+"s+ c #AEAEAE",
+"t+ c #ADADAD",
+"u+ c #ACACAC",
+"v+ c #ABABAB",
+"w+ c #AAAAAA",
+"x+ c #A8A8A8",
+"y+ c #A7A7A7",
+"z+ c #A6A6A6",
+"A+ c #A5A5A5",
+"B+ c #A4A4A4",
+"C+ c #A1A1A1",
+"D+ c #A0A0A0",
+"E+ c #9F9F9F",
+"F+ c #EAEAEA",
+"G+ c #848484",
+"H+ c #8A8A8A",
+"I+ c #929292",
+"J+ c #999999",
+"K+ c #9E9E9E",
+"L+ c #A3A3A3",
+"M+ c #989898",
+"N+ c #C5C5C5",
+"O+ c #949494",
+"P+ c #C2C2C2",
+"Q+ c #C1C1C1",
+"R+ c #909090",
+"S+ c #BFBFBF",
+"T+ c #878787",
+"U+ c #969696",
+"V+ c #C0C0C0",
+"W+ c #8F8F8F",
+"X+ c #8E8E8E",
+"Y+ c #8C8C8C",
+"Z+ c #A9A9A9",
+"`+ c #939393",
+" @ c #B0B0B0",
+".@ c #525252",
+"+@ c #C9C9C9",
+"@@ c #C7C7C7",
+"#@ c #BBBBBB",
+"$@ c #515151",
+"%@ c #505050",
+" ",
+" . + @ # $ ",
+" % & * = - ; > , ' ",
+" % ) ! ~ { ] ^ / ( _ : ",
+" < [ } | 1 2 3 4 5 6 7 8 # ",
+" 9 0 a b c d e f g 3 h i ",
+" < j k 3 l m n o p ",
+" q r s t u v w x y ",
+" z A B B B B C D E F G H I J B K K K L M ",
+" M N O P Q Q O R c ~ S T U V W X Y Z ` ... ",
+" z Y +.y y y y y : @.#.$.%.&.y y y y y *.=.M ",
+" -.;.>.,.'.).t w 6 !.~.{.].^./.( / (._.:.<.[. ",
+" M }.|.1.2.3.4.5.#.].6.7.8.9.0.a.b.c.d.e.f.g.h.M ",
+" i.j.k.l.m.m.n.o.p.q.r.s.t.u.u.v.w.x.y.z.A.A.B.C. ",
+" z D.E.k.>.>.l.F.G.H.U I.u.u.u.J.K.L.M.z.N.O.P.l.Q. ",
+" R.E.l.>.l.g.1.S.T.U.V.W.a.u.X.Y.Z.`.P.A.O.O.O.O.P.M ",
+" +Y z.m.1.z.A..+.+++@+#+$+%+&+*+=+-+;+>+,+.+=.,+>.'+ ",
+" M P.m.z.2.}..+)+)+,+;+!+~+{+]+^+/+(+_+:+<+-+P.N.>+N.D.z ",
+" [+Y z.A.f.}.}.f.,+;+}+|+1+2+3+4+5+6+7+_+<+P.A.<+-+8+1.9+ ",
+" 0+a+S.O.P..+O.g.=.f.b+c+|+d+y d+7+_+-+f.O.>+}+b+>+P.S.e+ ",
+" M B.k.f+m.O.A..+)+.+A.z.z.N.O.g+A.N.A.f.-+}+b+;+8+g.X O.8+h+ ",
+" M X z.S.N.z.z.z.z.N.A.P.f..+,+,+,+)+.+f.f.P.P.P.f..+f.)+i+R. ",
+" M E.1.k.k.1.1.}.}.=.S.S.S.z.z.N.N.O.O.O.A.P.f.f..+.+)+)+-+M ",
+" M |.j+j+k+l+m+n+o+p+q+r+N s+t+u+v+w+x+y+z+A+B+Q.C+D+E+E+k+M ",
+" M F+j+j+G+H+I+J+K+L+y+w+u+t+s+v+w+M+N+-.h.O+P+I+Q+R+S+E+m+M ",
+" M B.j+k+T+H+I+J+K+L+y+w+v+t+t+v+w+M+N+U+h.O+P+ +V+W+S+E+o+M ",
+" M m.j+k+X+Y+I+J+K+L+y+w+v+t+u+w+Z+M+N+U+h.`+Q+ +V+W+S+E+q+M ",
+" M l.j+l+l+n+k+p+ @N u+t+w+u+u+w+Z+-.6+..h.`+Q+R+S+W+S+D+s+M ",
+" .(a)N+k.1.=.z.N.A.f.)+8+;+b+<+c++@@@6+P+S+D.#@k+0+o+q+r+N ..$@ ",
+" $@M M M M M M M M M M M M M M M M M M M M M M M M M M %@ ",
+" ",
+" "};
Added: trunk/gtk/src/icons/pkg-installed-locked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-installed-lock…
==============================================================================
--- trunk/gtk/src/icons/pkg-installed-locked.xpm (added)
+++ trunk/gtk/src/icons/pkg-installed-locked.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,595 @@
+/* XPM */
+static const char * pkg_installed_locked_xpm[] = {
+"32 32 560 2",
+" c None",
+". c #949594",
+"+ c #909090",
+"@ c #8F8F8F",
+"# c #8D8D8D",
+"$ c #8B8B8B",
+"% c #898989",
+"& c #878787",
+"* c #868686",
+"= c #848484",
+"- c #828282",
+"; c #808080",
+"> c #7E7E7E",
+", c #7D7D7D",
+"' c #7B7B7B",
+") c #797979",
+"! c #777777",
+"~ c #7C7C7C",
+"{ c #959595",
+"] c #F1F2EF",
+"^ c #F5F6F3",
+"/ c #F4F5F3",
+"( c #F4F5F2",
+"_ c #F4F4F2",
+": c #F3F4F2",
+"< c #F3F4F1",
+"[ c #F2F4F1",
+"} c #F2F3F1",
+"| c #EDEEEB",
+"1 c #A2A2A2",
+"2 c #F2F3F0",
+"3 c #B9BBC8",
+"4 c #3E3F8E",
+"5 c #545592",
+"6 c #535491",
+"7 c #525290",
+"8 c #515190",
+"9 c #52528F",
+"0 c #51518F",
+"a c #50508F",
+"b c #51518E",
+"c c #53548D",
+"d c #52538D",
+"e c #52528B",
+"f c #51518B",
+"g c #53538D",
+"h c #55568E",
+"i c #54548E",
+"j c #55558E",
+"k c #54548D",
+"l c #535494",
+"m c #D4D7D0",
+"n c #EEF0ED",
+"o c #858685",
+"p c #AAAAA9",
+"q c #F0F2EE",
+"r c #A7AAC0",
+"s c #6A6A91",
+"t c #7E7E96",
+"u c #7D7D95",
+"v c #7C7C94",
+"w c #7A7A93",
+"x c #797992",
+"y c #777790",
+"z c #767690",
+"A c #75758F",
+"B c #74748D",
+"C c #73738D",
+"D c #71718B",
+"E c #70708B",
+"F c #6F6F8A",
+"G c #6D6D88",
+"H c #6B6B86",
+"I c #6A6A85",
+"J c #696985",
+"K c #494A8B",
+"L c #A4A5A2",
+"M c #CFD1CF",
+"N c #8D8E8D",
+"O c #AFB0AF",
+"P c #EFF0ED",
+"Q c #9697B8",
+"R c #67678C",
+"S c #6E6E89",
+"T c #686884",
+"U c #676783",
+"V c #666683",
+"W c #656582",
+"X c #646482",
+"Y c #636380",
+"Z c #626280",
+"` c #454688",
+" . c #D3D6CF",
+".. c #EAECE8",
+"+. c #959695",
+"@. c #B8B8B7",
+"#. c #EEEFEB",
+"$. c #8284AD",
+"%. c #646488",
+"&. c #6A6A86",
+"*. c #676784",
+"=. c #646481",
+"-. c #616180",
+";. c #61617F",
+">. c #5F5F7F",
+",. c #5F5F7E",
+"'. c #535375",
+"). c #3F4084",
+"!. c #B2B4B0",
+"~. c #B7B8B7",
+"{. c #9B9C9B",
+"]. c #BFBFBE",
+"^. c #ECEDE9",
+"/. c #7173A4",
+"(. c #646486",
+"_. c #696986",
+":. c #676785",
+"<. c #666684",
+"[. c #656583",
+"}. c #646483",
+"|. c #636381",
+"1. c #626281",
+"2. c #616181",
+"3. c #606080",
+"4. c #60607F",
+"5. c #5E5E7E",
+"6. c #5B5B7D",
+"7. c #49496E",
+"8. c #36365F",
+"9. c #292954",
+"0. c #242450",
+"a. c #373880",
+"b. c #D2D5CE",
+"c. c #E5E7E3",
+"d. c #A4A5A3",
+"e. c #C5C5C3",
+"f. c #EAECE7",
+"g. c #61639D",
+"h. c #5F5F80",
+"i. c #5D5D7F",
+"j. c #5C5C7E",
+"k. c #565679",
+"l. c #3E3E66",
+"m. c #2A2A56",
+"n. c #272754",
+"o. c #282855",
+"p. c #34357E",
+"q. c #B8BBB6",
+"r. c #ACADAB",
+"s. c #CACBC9",
+"t. c #E8EAE5",
+"u. c #575998",
+"v. c #606081",
+"w. c #5E5E80",
+"x. c #5C5C7F",
+"y. c #5B5B7E",
+"z. c #5A5A7E",
+"A. c #5A5A7D",
+"B. c #58587C",
+"C. c #545479",
+"D. c #3F3F69",
+"E. c #2C2C59",
+"F. c #2A2A58",
+"G. c #2B2B59",
+"H. c #2B2B5A",
+"I. c #2C2C5A",
+"J. c #2C2C5B",
+"K. c #30317C",
+"L. c #D0D4CD",
+"M. c #E0E2DD",
+"N. c #B0B1AF",
+"O. c #8C8C8C",
+"P. c #CFD0CD",
+"Q. c #E7E9E4",
+"R. c #535595",
+"S. c #5B5B7F",
+"T. c #59597E",
+"U. c #59597D",
+"V. c #58587D",
+"W. c #57577C",
+"X. c #55557C",
+"Y. c #474770",
+"Z. c #31315F",
+"`. c #2D2D5C",
+" + c #2E2E5D",
+".+ c #2F2F5E",
+"++ c #2F2F5F",
+"@+ c #30305F",
+"#+ c #303060",
+"$+ c #2D2D7B",
+"%+ c #BFC1BC",
+"&+ c #A4A4A3",
+"*+ c #B6B7B5",
+"=+ c #5D5D5D",
+"-+ c #8E8E8E",
+";+ c #D3D5D2",
+">+ c #E5E7E2",
+",+ c #525393",
+"'+ c #58587F",
+")+ c #58587E",
+"!+ c #57577D",
+"~+ c #56567D",
+"{+ c #54547C",
+"]+ c #53537B",
+"^+ c #4D4D76",
+"/+ c #393967",
+"(+ c #313160",
+"_+ c #313161",
+":+ c #323262",
+"<+ c #333363",
+"[+ c #333364",
+"}+ c #343465",
+"|+ c #2E2E7A",
+"1+ c #C5C9C7",
+"2+ c #DBDDD8",
+"3+ c #BBBCB9",
+"4+ c #5E5E5E",
+"5+ c #8E8E8D",
+"6+ c #D8D8D6",
+"7+ c #E3E6E0",
+"8+ c #505192",
+"9+ c #54547D",
+"0+ c #52527B",
+"a+ c #4F4F79",
+"b+ c #41416E",
+"c+ c #353565",
+"d+ c #353566",
+"e+ c #353567",
+"f+ c #363667",
+"g+ c #363668",
+"h+ c #373768",
+"i+ c #373769",
+"j+ c #383869",
+"k+ c #38386A",
+"l+ c #303078",
+"m+ c #B8BCC3",
+"n+ c #D8DBD5",
+"o+ c #C0C1BE",
+"p+ c #606060",
+"q+ c #DCDDDA",
+"r+ c #E1E4DE",
+"s+ c #4C4D90",
+"t+ c #51517C",
+"u+ c #50507C",
+"v+ c #50507B",
+"w+ c #4E4E7B",
+"x+ c #464674",
+"y+ c #39396B",
+"z+ c #3A3A6C",
+"A+ c #3A3A6D",
+"B+ c #3B3B6D",
+"C+ c #3B3B6E",
+"D+ c #3C3C6F",
+"E+ c #3C3C70",
+"F+ c #313179",
+"G+ c #ADB0BD",
+"H+ c #D5D9D3",
+"I+ c #C4C6C2",
+"J+ c #8A8A89",
+"K+ c #DFE0DE",
+"L+ c #DFE1DC",
+"M+ c #48498E",
+"N+ c #4B4B7A",
+"O+ c #444474",
+"P+ c #3C3C6E",
+"Q+ c #3D3D70",
+"R+ c #3D3D71",
+"S+ c #3E3E71",
+"T+ c #3E3E72",
+"U+ c #3F3F73",
+"V+ c #404074",
+"W+ c #404075",
+"X+ c #323277",
+"Y+ c #A0A3B9",
+"Z+ c #D4D6D0",
+"`+ c #C8CAC7",
+" @ c #5E5E5C",
+".@ c #E3E3E1",
+"+@ c #DCE0D9",
+"@@ c #41418B",
+"#@ c #404072",
+"$@ c #414175",
+"%@ c #414176",
+"&@ c #424276",
+"*@ c #424277",
+"=@ c #434378",
+"-@ c #434379",
+";@ c #444479",
+">@ c #44447A",
+",@ c #45457A",
+"'@ c #36367B",
+")@ c #9193B1",
+"!@ c #D1D5CF",
+"~@ c #CCCECB",
+"{@ c #585958",
+"]@ c #848584",
+"^@ c #E5E6E3",
+"/@ c #DBDED6",
+"(@ c #3C3C88",
+"_@ c #45457B",
+":@ c #46467C",
+"<@ c #47477D",
+"[@ c #47477E",
+"}@ c #48487E",
+"|@ c #48487F",
+"1@ c #49497F",
+"2@ c #3D3D7E",
+"3@ c #8183AA",
+"4@ c #CFD2CC",
+"5@ c #D1D2CF",
+"6@ c #575756",
+"7@ c #808180",
+"8@ c #E7E9E6",
+"9@ c #D9DCD5",
+"0@ c #383987",
+"a@ c #46467D",
+"b@ c #494980",
+"c@ c #4A4A81",
+"d@ c #4B4B82",
+"e@ c #4B4B83",
+"f@ c #4C4C84",
+"g@ c #4D4D85",
+"h@ c #454583",
+"i@ c #7073A3",
+"j@ c #CDD1CB",
+"k@ c #D3D6D1",
+"l@ c #525252",
+"m@ c #EAEBE8",
+"n@ c #D7DAD2",
+"o@ c #202184",
+"p@ c #3B3C87",
+"q@ c #3B3C88",
+"r@ c #3B3B88",
+"s@ c #3B3C89",
+"t@ c #3C3C89",
+"u@ c #3C3C8A",
+"v@ c #3C3D8A",
+"w@ c #3D3D8A",
+"x@ c #373889",
+"y@ c #66689F",
+"z@ c #CBCFC8",
+"A@ c #D7D9D5",
+"B@ c #4D4D4D",
+"C@ c #787878",
+"D@ c #EAECE9",
+"E@ c #D1D4CE",
+"F@ c #CED2CA",
+"G@ c #CED1CA",
+"H@ c #CDD1C9",
+"I@ c #CDD0C9",
+"J@ c #CCD0C8",
+"K@ c #CCCFC8",
+"L@ c #CBCFC7",
+"M@ c #CBCEC7",
+"N@ c #CACEC6",
+"O@ c #AEB0AB",
+"P@ c #B3B6AF",
+"Q@ c #C9CCC5",
+"R@ c #C8CCC4",
+"S@ c #C8CBC4",
+"T@ c #C7CBC4",
+"U@ c #C7CAC3",
+"V@ c #C6CAC3",
+"W@ c #747672",
+"X@ c #343534",
+"Y@ c #2C2C2B",
+"Z@ c #2B2C2B",
+"`@ c #2F302F",
+" # c #A6A8A5",
+".# c #494949",
+"+# c #D4D6D2",
+"@# c #EBECE9",
+"## c #E9EBE7",
+"$# c #E8EAE6",
+"%# c #E7E9E5",
+"&# c #E6E8E5",
+"*# c #E6E8E4",
+"=# c #E4E6E2",
+"-# c #E3E6E1",
+";# c #E2E5E1",
+"># c #E2E4E0",
+",# c #E1E3DF",
+"'# c #D2D4D1",
+")# c #6F706E",
+"!# c #D2D2D2",
+"~# c #DBDBDB",
+"{# c #BCBCBC",
+"]# c #767676",
+"^# c #272727",
+"/# c #747474",
+"(# c #6E6E6E",
+"_# c #6C6C6C",
+":# c #6A6A6A",
+"<# c #686868",
+"[# c #676767",
+"}# c #656565",
+"|# c #636363",
+"1# c #616161",
+"2# c #5F5F5F",
+"3# c #5C5C5C",
+"4# c #5A5A5A",
+"5# c #585858",
+"6# c #565656",
+"7# c #555555",
+"8# c #535353",
+"9# c #515151",
+"0# c #313131",
+"a# c #838383",
+"b# c #BABABA",
+"c# c #383838",
+"d# c #1D1D1D",
+"e# c #4C4C4C",
+"f# c #B1B1B1",
+"g# c #4F504E",
+"h# c #838581",
+"i# c #ACAFA9",
+"j# c #ADB0AA",
+"k# c #8B8E89",
+"l# c #8D908C",
+"m# c #ABADAA",
+"n# c #A7A7A6",
+"o# c #363636",
+"p# c #C1C1C1",
+"q# c #0D0D0D",
+"r# c #2E2E2E",
+"s# c #AAAAAA",
+"t# c #000000",
+"u# c #525451",
+"v# c #9B9E9A",
+"w# c #AFB2AC",
+"x# c #B1B3AE",
+"y# c #AEB1AB",
+"z# c #A8AAA5",
+"A# c #2C2C2C",
+"B# c #BFBFBF",
+"C# c #141414",
+"D# c #A1A1A1",
+"E# c #A5A5A5",
+"F# c #A8A8A8",
+"G# c #171717",
+"H# c #C1C0C0",
+"I# c #595959",
+"J# c #595958",
+"K# c #585857",
+"L# c #575757",
+"M# c #515150",
+"N# c #505050",
+"O# c #14120F",
+"P# c #9B9794",
+"Q# c #201D1C",
+"R# c #0B0B07",
+"S# c #040302",
+"T# c #050403",
+"U# c #2F2921",
+"V# c #A8A39E",
+"W# c #1A130B",
+"X# c #DCE0D8",
+"Y# c #DFE3DB",
+"Z# c #DFE3DA",
+"`# c #E0E3DA",
+" $ c #E0E3DB",
+".$ c #E1E3DB",
+"+$ c #E0E4DB",
+"@$ c #E0E4DC",
+"#$ c #A59176",
+"$$ c #E0C4A0",
+"%$ c #DFC4A3",
+"&$ c #DABE9A",
+"*$ c #D6BA94",
+"=$ c #CDA676",
+"-$ c #815A2B",
+";$ c #949693",
+">$ c #9F9F9E",
+",$ c #9D9D9D",
+"'$ c #E2C5A1",
+")$ c #D8B58C",
+"!$ c #CA9F68",
+"~$ c #AC8758",
+"{$ c #A78252",
+"]$ c #A78253",
+"^$ c #A37B4B",
+"/$ c #BC8849",
+"($ c #AC712E",
+"_$ c #636463",
+":$ c #BBBDB8",
+"<$ c #9FA09F",
+"[$ c #9C9D9C",
+"}$ c #E3C6A2",
+"|$ c #D5AE7E",
+"1$ c #B08D5F",
+"2$ c #D5B284",
+"3$ c #CFAB7C",
+"4$ c #CFAC7B",
+"5$ c #CBA471",
+"6$ c #BC8746",
+"7$ c #AA6F2B",
+"8$ c #676867",
+"9$ c #BDC0BC",
+"0$ c #A7A9A6",
+"a$ c #AEAEAE",
+"b$ c #ACACAB",
+"c$ c #E1C4A0",
+"d$ c #D0A674",
+"e$ c #C79B64",
+"f$ c #AA8455",
+"g$ c #A47E4E",
+"h$ c #A07744",
+"i$ c #BA8442",
+"j$ c #A4A7A2",
+"k$ c #959991",
+"l$ c #7A7D77",
+"m$ c #A3A6A0",
+"n$ c #777874",
+"o$ c #858782",
+"p$ c #989B94",
+"q$ c #E1C29C",
+"r$ c #CEA470",
+"s$ c #AD8D64",
+"t$ c #D2B289",
+"u$ c #CDAC83",
+"v$ c #CEAD83",
+"w$ c #CCA77B",
+"x$ c #B8803E",
+"y$ c #AD7332",
+"z$ c #D4D9D1",
+"A$ c #E0E5DC",
+"B$ c #E1E5DE",
+"C$ c #E2E5DE",
+"D$ c #E1E6DD",
+"E$ c #E2E6DE",
+"F$ c #E1E6DF",
+"G$ c #E2E7DE",
+"H$ c #E2E7DD",
+"I$ c #E3E7DE",
+"J$ c #E3E8DE",
+"K$ c #E3E8DF",
+"L$ c #E0C29E",
+"M$ c #D4AC79",
+"N$ c #CDA66E",
+"O$ c #AF8D5E",
+"P$ c #AB8758",
+"Q$ c #AB8858",
+"R$ c #A8814C",
+"S$ c #B47E3E",
+"T$ c #575857",
+"U$ c #5A5B5A",
+"V$ c #595A59",
+"W$ c #555655",
+"X$ c #535453",
+"Y$ c #525352",
+"Z$ c #515251",
+"`$ c #525251",
+" % c #D0A874",
+".% c #C6965D",
+"+% c #BE8D50",
+"@% c #BA894B",
+"#% c #BD8C4E",
+"$% c #BC8A4C",
+"%% c #BA8647",
+"&% c #A47136",
+" . + @ @ @ @ @ @ @ @ @ @ # $ % & * = - ; > , ' ) ! ~ ",
+" { ] ^ ^ ^ ^ ^ ^ / / / / ( ( _ _ : : : < < < [ } | ) ",
+" 1 2 3 4 5 5 6 7 8 9 0 a b c d e f g h i j k l m n o ",
+" p q r s t u v w x y z A B C D E F G G H I J K L M N ",
+" O P Q R z A B C D E S G G H I T U V W X Y Z ` ...+. ",
+" @.#.$.%.S G G H &.J T *.V V =.=.Z -.;.>.,.'.).!.~.{. ",
+" ].^./.(._.:.*.<.[.}.|.1.2.3.4.>.5.6.7.8.9.0.a.b.c.d. ",
+" e.f.g.(.}.}.1.2.2.h.h.i.i.j.6.k.l.m.n.n.o.o.p.q.r.r. ",
+" s.t.u.2.v.h.w.x.x.y.z.A.B.C.D.E.F.G.G.H.I.J.K.L.M.N. ",
+" O.P.Q.R.x.S.S.T.U.V.W.W.X.Y.Z.`. + +.+.+++@+#+$+%+&+*+=+ ",
+" -+;+>+,+'+)+!+~+X.{+]+^+/+(+_+_+:+:+<+[+[+}+}+|+1+2+3+4+ ",
+" 5+6+7+8+9+{+{+0+0+a+b+c+}+d+d+e+f+g+h+i+j+k+k+l+m+n+o+p+ ",
+" # q+r+s+t+u+v+w+x+y+i+k+k+y+y+z+z+A+B+C+D+D+E+F+G+H+I+4+ ",
+" J+K+L+M+w+N+O+D+B+C+P+D+E+Q+R+S+T+T+U+U+V+V+W+X+Y+Z+`+ @ ",
+" & .@+@@@#@R+T+T+U+U+V+V+W+$@%@&@*@*@=@-@;@>@,@'@)@!@~@{@ ",
+" ]@^@/@(@%@&@*@*@=@=@;@;@>@_@_@:@:@<@<@[@}@|@1@2@3@4@5@6@ ",
+" 7@8@9@0@_@:@:@a@<@[@}@|@1@b@b@c@c@d@d@e@f@f@g@h@i@j@k@l@ ",
+" ~ m@n@o@p@q@r@r@q@s@t@t@t@s@s@t@u@v@v@v@w@v@v@x@y@z@A@B@ ",
+" C@D@E@F@G@H@I@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ #.# ",
+" C@+#@#@#..m@##$#$#%#&#*#c.>+=#-#;#>#,#'#)#' !#~#~#{#]#^# ",
+" /#(#_#:#<#[#}#|#1#2#4+3#4#5#6#7#8#9#0#a#b#c#d#d#e#f#a# ",
+" g#h#i#j#k#k#k#k#k#l#m#n#o#p#q# r#s#t# ",
+" u#v#w#x#w#y#j#j#y#y#j#z#A#B#C#D#E#F#E#G#H#t# ",
+" <#|#1#2#4+3#I#5#J#I#K#L#7#8#9#M#N#0#O#P#Q#R#S#S#T#U#V#W# ",
+" |#X#Y#Y#Z#Y#Y#`# $`# $.$+$+$+$@$@$t##$$$%$%$&$&$&$*$=$-$t#",
+" ;$>$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$t#'$)$!$~${${$]$^$/$($t#",
+" _$:$E#E#E#<$[$[$[$[$[$[$[$[$[$[$E#E#t#}$|$1$2$3$3$4$5$6$7$t#",
+" 8$9$s#s#s#0$a$a$a$a$a$a$a$a$a$b$&+a$t#c$d$e$f$g$g$g$h$i$($t#",
+" j$k$l$l$l$m$n$n$n$n$n$n$n$n$n$o$p$l$t#q$r$s$t$u$u$v$w$x$y$t#",
+" 2#z$@$@$A$A$B$C$D$E$D$F$G$G$H$G$I$J$K$t#L$M$N$O$P$P$Q$R$6$S$t#",
+" I#T$U$V$T$W$X$Y$Y$Y$Z$Z$Z$Z$`$`$`$`$`$t# %.%+%+%@%@%#%$%%%&%t#",
+" t#t#t#t#t#t#t#t#t#t# "};
Added: trunk/gtk/src/icons/pkg-installed-upgradable-locked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-installed-upgr…
==============================================================================
--- trunk/gtk/src/icons/pkg-installed-upgradable-locked.xpm (added)
+++ trunk/gtk/src/icons/pkg-installed-upgradable-locked.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,595 @@
+/* XPM */
+static const char * pkg_installed_upgradable_locked_xpm[] = {
+"32 32 560 2",
+" c None",
+". c #949594",
+"+ c #909090",
+"@ c #8F8F8F",
+"# c #8D8D8D",
+"$ c #8B8B8B",
+"% c #898989",
+"& c #878787",
+"* c #868686",
+"= c #848382",
+"- c #B76F2C",
+"; c #CB6913",
+"> c #CE5F05",
+", c #CE5C00",
+"' c #CD5F04",
+") c #C66512",
+"! c #986B47",
+"~ c #7C7C7C",
+"{ c #959595",
+"] c #F1F2EF",
+"^ c #F5F6F3",
+"/ c #F4F5F3",
+"( c #F4F5F2",
+"_ c #F4F4F2",
+": c #DFB994",
+"< c #D16911",
+"[ c #E0811C",
+"} c #F0A132",
+"| c #F7AE3B",
+"1 c #F8B13E",
+"2 c #F7AC3B",
+"3 c #F09F32",
+"4 c #DD7F1E",
+"5 c #C36110",
+"6 c #A2A2A2",
+"7 c #F2F3F0",
+"8 c #B9BBC8",
+"9 c #3E3F8E",
+"0 c #545592",
+"a c #535491",
+"b c #525290",
+"c c #515190",
+"d c #52528F",
+"e c #51518F",
+"f c #50508F",
+"g c #51518E",
+"h c #53548D",
+"i c #52538D",
+"j c #795659",
+"k c #CF6005",
+"l c #EE9C2F",
+"m c #F8AC3D",
+"n c #F79A38",
+"o c #F79537",
+"p c #F79938",
+"q c #F8A63B",
+"r c #E9972E",
+"s c #CC5D00",
+"t c #AAAAA9",
+"u c #F0F2EE",
+"v c #A7AAC0",
+"w c #6A6A91",
+"x c #7E7E96",
+"y c #7D7D95",
+"z c #7C7C94",
+"A c #7A7A93",
+"B c #797992",
+"C c #777790",
+"D c #767690",
+"E c #75758F",
+"F c #74748D",
+"G c #73738D",
+"H c #717087",
+"I c #CE660D",
+"J c #EE9C2E",
+"K c #F8A33B",
+"L c #FBD8B7",
+"M c #FFFFFF",
+"N c #FBD5B0",
+"O c #F89E39",
+"P c #E7952B",
+"Q c #CC5C00",
+"R c #AFB0AF",
+"S c #EFF0ED",
+"T c #9697B8",
+"U c #67678C",
+"V c #71718B",
+"W c #70708B",
+"X c #6E6E89",
+"Y c #6D6D88",
+"Z c #6B6B86",
+"` c #AE672B",
+" . c #E1811D",
+".. c #F8AB3C",
+"+. c #FBD5B2",
+"@. c #F8A43A",
+"#. c #DA7A14",
+"$. c #B8B8B7",
+"%. c #EEEFEB",
+"&. c #8284AD",
+"*. c #646488",
+"=. c #6A6A86",
+"-. c #696985",
+";. c #686884",
+">. c #676784",
+",. c #666683",
+"'. c #CA6510",
+"). c #F69130",
+"!. c #FAC796",
+"~. c #FBD4AE",
+"{. c #FAC898",
+"]. c #F79837",
+"^. c #E7962A",
+"/. c #BFBFBE",
+"(. c #ECEDE9",
+"_. c #7173A4",
+":. c #646486",
+"<. c #696986",
+"[. c #676785",
+"}. c #666684",
+"|. c #656583",
+"1. c #646483",
+"2. c #636381",
+"3. c #626281",
+"4. c #616181",
+"5. c #606080",
+"6. c #F7AB3B",
+"7. c #F69132",
+"8. c #F9B97B",
+"9. c #FBCEA3",
+"0. c #F8B778",
+"a. c #F78E2A",
+"b. c #F79333",
+"c. c #EFA033",
+"d. c #CD5B00",
+"e. c #C5C5C3",
+"f. c #EAECE7",
+"g. c #61639D",
+"h. c #5F5F80",
+"i. c #5D5D7F",
+"j. c #5C5C7E",
+"k. c #F8AD3D",
+"l. c #F79434",
+"m. c #F58416",
+"n. c #F6A352",
+"o. c #F9BD82",
+"p. c #F8A85B",
+"q. c #F57900",
+"r. c #F57A01",
+"s. c #F68517",
+"t. c #F7912E",
+"u. c #F1A235",
+"v. c #CACBC9",
+"w. c #E8EAE5",
+"x. c #575998",
+"y. c #606081",
+"z. c #5E5E80",
+"A. c #5C5C7F",
+"B. c #5B5B7E",
+"C. c #5A5A7E",
+"D. c #5A5A7D",
+"E. c #58587C",
+"F. c #545479",
+"G. c #CB5D02",
+"H. c #F6A531",
+"I. c #F78F29",
+"J. c #F68415",
+"K. c #F57A02",
+"L. c #EB9929",
+"M. c #8C8C8C",
+"N. c #CFD0CD",
+"O. c #E7E9E4",
+"P. c #535595",
+"Q. c #5B5B7F",
+"R. c #59597E",
+"S. c #59597D",
+"T. c #58587D",
+"U. c #57577C",
+"V. c #55557C",
+"W. c #474770",
+"X. c #31315F",
+"Y. c #BE5B0C",
+"Z. c #F0921D",
+"`. c #F57E04",
+" + c #F57D04",
+".+ c #E69426",
+"++ c #8E8E8E",
+"@+ c #D3D5D2",
+"#+ c #E5E7E2",
+"$+ c #525393",
+"%+ c #58587F",
+"&+ c #58587E",
+"*+ c #57577D",
+"=+ c #56567D",
+"-+ c #54547C",
+";+ c #53537B",
+">+ c #4D4D76",
+",+ c #393967",
+"'+ c #313160",
+")+ c #313161",
+"!+ c #744334",
+"~+ c #D87814",
+"{+ c #F79116",
+"]+ c #EC9222",
+"^+ c #D87712",
+"/+ c #8E8E8D",
+"(+ c #D8D8D6",
+"_+ c #E3E6E0",
+":+ c #505192",
+"<+ c #54547D",
+"[+ c #52527B",
+"}+ c #4F4F79",
+"|+ c #41416E",
+"1+ c #353565",
+"2+ c #343465",
+"3+ c #353566",
+"4+ c #353567",
+"5+ c #BA580D",
+"6+ c #EA9020",
+"7+ c #F6870D",
+"8+ c #F58A13",
+"9+ c #D88B26",
+"0+ c #DCDDDA",
+"a+ c #E1E4DE",
+"b+ c #4C4D90",
+"c+ c #51517C",
+"d+ c #50507C",
+"e+ c #50507B",
+"f+ c #4E4E7B",
+"g+ c #464674",
+"h+ c #39396B",
+"i+ c #373769",
+"j+ c #38386A",
+"k+ c #3A3A6C",
+"l+ c #544058",
+"m+ c #C65A04",
+"n+ c #E38E23",
+"o+ c #F79117",
+"p+ c #EF9425",
+"q+ c #DC9433",
+"r+ c #C65B05",
+"s+ c #8A8A89",
+"t+ c #DFE0DE",
+"u+ c #DFE1DC",
+"v+ c #48498E",
+"w+ c #4B4B7A",
+"x+ c #444474",
+"y+ c #3C3C6F",
+"z+ c #3B3B6D",
+"A+ c #3B3B6E",
+"B+ c #3C3C6E",
+"C+ c #3C3C70",
+"D+ c #3D3D70",
+"E+ c #3D3D71",
+"F+ c #3E3E71",
+"G+ c #3E3E72",
+"H+ c #533F55",
+"I+ c #AF5313",
+"J+ c #D17518",
+"K+ c #DD8C25",
+"L+ c #EC9727",
+"M+ c #F19927",
+"N+ c #E09029",
+"O+ c #DD912E",
+"P+ c #D0802B",
+"Q+ c #C66D25",
+"R+ c #765D47",
+"S+ c #E3E3E1",
+"T+ c #DCE0D9",
+"U+ c #41418B",
+"V+ c #404072",
+"W+ c #3F3F73",
+"X+ c #404074",
+"Y+ c #404075",
+"Z+ c #414175",
+"`+ c #414176",
+" @ c #424276",
+".@ c #424277",
+"+@ c #434378",
+"@@ c #6E433A",
+"#@ c #A04F19",
+"$@ c #C15706",
+"%@ c #CB5A00",
+"&@ c #BF5706",
+"*@ c #B05F24",
+"=@ c #B18762",
+"-@ c #CCCECB",
+";@ c #585958",
+">@ c #848584",
+",@ c #E5E6E3",
+"'@ c #DBDED6",
+")@ c #3C3C88",
+"!@ c #444479",
+"~@ c #44447A",
+"{@ c #45457B",
+"]@ c #46467C",
+"^@ c #47477D",
+"/@ c #47477E",
+"(@ c #48487E",
+"_@ c #48487F",
+":@ c #49497F",
+"<@ c #3D3D7E",
+"[@ c #8183AA",
+"}@ c #CFD2CC",
+"|@ c #D1D2CF",
+"1@ c #575756",
+"2@ c #808180",
+"3@ c #E7E9E6",
+"4@ c #D9DCD5",
+"5@ c #383987",
+"6@ c #46467D",
+"7@ c #494980",
+"8@ c #4A4A81",
+"9@ c #4B4B82",
+"0@ c #4B4B83",
+"a@ c #4C4C84",
+"b@ c #4D4D85",
+"c@ c #454583",
+"d@ c #7073A3",
+"e@ c #CDD1CB",
+"f@ c #D3D6D1",
+"g@ c #525252",
+"h@ c #EAEBE8",
+"i@ c #D7DAD2",
+"j@ c #202184",
+"k@ c #3B3C87",
+"l@ c #3B3C88",
+"m@ c #3B3B88",
+"n@ c #3B3C89",
+"o@ c #3C3C89",
+"p@ c #3C3C8A",
+"q@ c #3C3D8A",
+"r@ c #3D3D8A",
+"s@ c #373889",
+"t@ c #66689F",
+"u@ c #CBCFC8",
+"v@ c #D7D9D5",
+"w@ c #4D4D4D",
+"x@ c #787878",
+"y@ c #EAECE9",
+"z@ c #D1D4CE",
+"A@ c #CED2CA",
+"B@ c #CED1CA",
+"C@ c #CDD1C9",
+"D@ c #CDD0C9",
+"E@ c #CCD0C8",
+"F@ c #CCCFC8",
+"G@ c #CBCFC7",
+"H@ c #CBCEC7",
+"I@ c #CACEC6",
+"J@ c #AEB0AB",
+"K@ c #B3B6AF",
+"L@ c #C9CCC5",
+"M@ c #C8CCC4",
+"N@ c #C8CBC4",
+"O@ c #C7CBC4",
+"P@ c #C7CAC3",
+"Q@ c #C6CAC3",
+"R@ c #747672",
+"S@ c #343534",
+"T@ c #2C2C2B",
+"U@ c #2B2C2B",
+"V@ c #2F302F",
+"W@ c #A6A8A5",
+"X@ c #494949",
+"Y@ c #D4D6D2",
+"Z@ c #EBECE9",
+"`@ c #EAECE8",
+" # c #E9EBE7",
+".# c #E8EAE6",
+"+# c #E7E9E5",
+"@# c #E6E8E5",
+"## c #E6E8E4",
+"$# c #E5E7E3",
+"%# c #E4E6E2",
+"&# c #E3E6E1",
+"*# c #E2E5E1",
+"=# c #E2E4E0",
+"-# c #E1E3DF",
+";# c #D2D4D1",
+"># c #6F706E",
+",# c #7B7B7B",
+"'# c #D2D2D2",
+")# c #DBDBDB",
+"!# c #BCBCBC",
+"~# c #767676",
+"{# c #272727",
+"]# c #747474",
+"^# c #6E6E6E",
+"/# c #6C6C6C",
+"(# c #6A6A6A",
+"_# c #686868",
+":# c #676767",
+"<# c #656565",
+"[# c #636363",
+"}# c #616161",
+"|# c #5F5F5F",
+"1# c #5E5E5E",
+"2# c #5C5C5C",
+"3# c #5A5A5A",
+"4# c #585858",
+"5# c #565656",
+"6# c #555555",
+"7# c #535353",
+"8# c #515151",
+"9# c #313131",
+"0# c #838383",
+"a# c #BABABA",
+"b# c #383838",
+"c# c #1D1D1D",
+"d# c #4C4C4C",
+"e# c #B1B1B1",
+"f# c #4F504E",
+"g# c #838581",
+"h# c #ACAFA9",
+"i# c #ADB0AA",
+"j# c #8B8E89",
+"k# c #8D908C",
+"l# c #ABADAA",
+"m# c #A7A7A6",
+"n# c #363636",
+"o# c #C1C1C1",
+"p# c #0D0D0D",
+"q# c #2E2E2E",
+"r# c #AAAAAA",
+"s# c #000000",
+"t# c #525451",
+"u# c #9B9E9A",
+"v# c #AFB2AC",
+"w# c #B1B3AE",
+"x# c #AEB1AB",
+"y# c #A8AAA5",
+"z# c #2C2C2C",
+"A# c #BFBFBF",
+"B# c #141414",
+"C# c #A1A1A1",
+"D# c #A5A5A5",
+"E# c #A8A8A8",
+"F# c #171717",
+"G# c #C1C0C0",
+"H# c #595959",
+"I# c #595958",
+"J# c #585857",
+"K# c #575757",
+"L# c #515150",
+"M# c #505050",
+"N# c #14120F",
+"O# c #9B9794",
+"P# c #201D1C",
+"Q# c #0B0B07",
+"R# c #040302",
+"S# c #050403",
+"T# c #2F2921",
+"U# c #A8A39E",
+"V# c #1A130B",
+"W# c #DCE0D8",
+"X# c #DFE3DB",
+"Y# c #DFE3DA",
+"Z# c #E0E3DA",
+"`# c #E0E3DB",
+" $ c #E1E3DB",
+".$ c #E0E4DB",
+"+$ c #E0E4DC",
+"@$ c #A59176",
+"#$ c #E0C4A0",
+"$$ c #DFC4A3",
+"%$ c #DABE9A",
+"&$ c #D6BA94",
+"*$ c #CDA676",
+"=$ c #815A2B",
+"-$ c #949693",
+";$ c #9F9F9E",
+">$ c #9D9D9D",
+",$ c #E2C5A1",
+"'$ c #D8B58C",
+")$ c #CA9F68",
+"!$ c #AC8758",
+"~$ c #A78252",
+"{$ c #A78253",
+"]$ c #A37B4B",
+"^$ c #BC8849",
+"/$ c #AC712E",
+"($ c #636463",
+"_$ c #BBBDB8",
+":$ c #9FA09F",
+"<$ c #9C9D9C",
+"[$ c #E3C6A2",
+"}$ c #D5AE7E",
+"|$ c #B08D5F",
+"1$ c #D5B284",
+"2$ c #CFAB7C",
+"3$ c #CFAC7B",
+"4$ c #CBA471",
+"5$ c #BC8746",
+"6$ c #AA6F2B",
+"7$ c #676867",
+"8$ c #BDC0BC",
+"9$ c #A7A9A6",
+"0$ c #AEAEAE",
+"a$ c #ACACAB",
+"b$ c #A4A4A3",
+"c$ c #E1C4A0",
+"d$ c #D0A674",
+"e$ c #C79B64",
+"f$ c #AA8455",
+"g$ c #A47E4E",
+"h$ c #A07744",
+"i$ c #BA8442",
+"j$ c #A4A7A2",
+"k$ c #959991",
+"l$ c #7A7D77",
+"m$ c #A3A6A0",
+"n$ c #777874",
+"o$ c #858782",
+"p$ c #989B94",
+"q$ c #E1C29C",
+"r$ c #CEA470",
+"s$ c #AD8D64",
+"t$ c #D2B289",
+"u$ c #CDAC83",
+"v$ c #CEAD83",
+"w$ c #CCA77B",
+"x$ c #B8803E",
+"y$ c #AD7332",
+"z$ c #D4D9D1",
+"A$ c #E0E5DC",
+"B$ c #E1E5DE",
+"C$ c #E2E5DE",
+"D$ c #E1E6DD",
+"E$ c #E2E6DE",
+"F$ c #E1E6DF",
+"G$ c #E2E7DE",
+"H$ c #E2E7DD",
+"I$ c #E3E7DE",
+"J$ c #E3E8DE",
+"K$ c #E3E8DF",
+"L$ c #E0C29E",
+"M$ c #D4AC79",
+"N$ c #CDA66E",
+"O$ c #AF8D5E",
+"P$ c #AB8758",
+"Q$ c #AB8858",
+"R$ c #A8814C",
+"S$ c #B47E3E",
+"T$ c #575857",
+"U$ c #5A5B5A",
+"V$ c #595A59",
+"W$ c #555655",
+"X$ c #535453",
+"Y$ c #525352",
+"Z$ c #515251",
+"`$ c #525251",
+" % c #D0A874",
+".% c #C6965D",
+"+% c #BE8D50",
+"@% c #BA894B",
+"#% c #BD8C4E",
+"$% c #BC8A4C",
+"%% c #BA8647",
+"&% c #A47136",
+" . + @ @ @ @ @ @ @ @ @ @ # $ % & * = - ; > , ' ) ! ~ ",
+" { ] ^ ^ ^ ^ ^ ^ / / / / ( ( _ _ : < [ } | 1 2 3 4 5 ",
+" 6 7 8 9 0 0 a b c d e f g h i j k l m n o o o p q r s ",
+" t u v w x y z A B C D E F G H I J K o o L M N o o O P Q ",
+" R S T U D E F G V W X Y Y Z ` ...o o o L M +.o o o @.#. ",
+" $.%.&.*.X Y Y Z =.-.;.>.,.,.'.3 p o o ).!.~.{.o o o ].^., ",
+" /.(._.:.<.[.>.}.|.1.2.3.4.5.' 6.o o o 7.8.9.0.a.b.o o c.d.",
+" e.f.g.:.1.1.3.4.4.h.h.i.i.j., k.o o l.m.n.o.p.q.r.s.t.u., ",
+" v.w.x.4.y.h.z.A.A.B.C.D.E.F.G.H.I.J.K.q.q.q.q.q.q.q.q.L., ",
+" M.N.O.P.A.Q.Q.R.S.T.U.U.V.W.X.Y.Z.`.q.q.q.o.M 8.q.q.q. +.+, ",
+" ++(a)+#+$+%+&+*+=+V.-+;+>+,+'+)+!+~+{+q.q.q.o.M 8.q.q.q.]+^+ ",
+" /+(+_+:+<+-+-+[+[+}+|+1+2+3+3+4+5+6+7+q.q.q.q.q.q.q.8+9+, ",
+" # 0+a+b+c+d+e+f+g+h+i+j+j+h+h+k+l+m+n+o+ +q.q.q. +p+q+r+ ",
+" s+t+u+v+f+w+x+y+z+A+B+y+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+ ",
+" & S+T+U+V+E+G+G+W+W+X+X+Y+Z+`+ @.@.@+@@@#@$@%@&@*@=@-@;@ ",
+" >@,@'@)@`+ @.@.@+@+@!@!@~@{@{@]@]@^@^@/@(@_@:@<@[@}@|@1@ ",
+" 2@3@4@5@{@]@]@6@^@/@(@_@:@7@7@8@8@9@9@0@a@a@b@c@d@e@f@g@ ",
+" ~ h@i@j@k@l@m@m@l@n@o@o@o@n@n@o@p@q@q@q@r@q@q@s@t@u@v@w@ ",
+" x@y@z@A@B@C@D@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@ ",
+" x@Y@Z@Z@`@h@ #.#.#+#@###$##+%#&#*#=#-#;#>#,#'#)#)#!#~#{# ",
+" ]#^#/#(#_#:#<#[#}#|#1#2#3#4#5#6#7#8#9#0#a#b#c#c#d#e#0# ",
+" f#g#h#i#j#j#j#j#j#k#l#m#n#o#p# q#r#s# ",
+" t#u#v#w#v#x#i#i#x#x#i#y#z#A#B#C#D#E#D#F#G#s# ",
+" _#[#}#|#1#2#H#4#I#H#J#K#6#7#8#L#M#9#N#O#P#Q#R#R#S#T#U#V# ",
+" [#W#X#X#Y#X#X#Z#`#Z#`# $.$.$.$+$+$s#@$#$$$$$%$%$%$&$*$=$s#",
+" -$;$>$>$>$>$>$>$>$>$>$>$>$>$>$>$>$s#,$'$)$!$~$~${$]$^$/$s#",
+" ($_$D#D#D#:$<$<$<$<$<$<$<$<$<$<$D#D#s#[$}$|$1$2$2$3$4$5$6$s#",
+" 7$8$r#r#r#9$0$0$0$0$0$0$0$0$0$a$b$0$s#c$d$e$f$g$g$g$h$i$/$s#",
+" j$k$l$l$l$m$n$n$n$n$n$n$n$n$n$o$p$l$s#q$r$s$t$u$u$v$w$x$y$s#",
+" |#z$+$+$A$A$B$C$D$E$D$F$G$G$H$G$I$J$K$s#L$M$N$O$P$P$Q$R$5$S$s#",
+" H#T$U$V$T$W$X$Y$Y$Y$Z$Z$Z$Z$`$`$`$`$`$s# %.%+%+%@%@%#%$%%%&%s#",
+" s#s#s#s#s#s#s#s#s#s# "};
Added: trunk/gtk/src/icons/pkg-installed-upgradable.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-installed-upgr…
==============================================================================
--- trunk/gtk/src/icons/pkg-installed-upgradable.xpm (added)
+++ trunk/gtk/src/icons/pkg-installed-upgradable.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,557 @@
+/* XPM */
+static const char * pkg_installed_upgradable_xpm[] = {
+"32 32 522 2",
+" c None",
+". c #949594",
+"+ c #909090",
+"@ c #8F8F8F",
+"# c #8D8D8D",
+"$ c #8B8B8B",
+"% c #898989",
+"& c #878787",
+"* c #868686",
+"= c #848382",
+"- c #B76F2C",
+"; c #CB6913",
+"> c #CE5F05",
+", c #CE5C00",
+"' c #CD5F04",
+") c #C66512",
+"! c #986B47",
+"~ c #7C7C7C",
+"{ c #959595",
+"] c #F1F2EF",
+"^ c #F5F6F3",
+"/ c #F4F5F3",
+"( c #F4F5F2",
+"_ c #F4F4F2",
+": c #DFB994",
+"< c #D16911",
+"[ c #E0811C",
+"} c #F0A132",
+"| c #F7AE3B",
+"1 c #F8B13E",
+"2 c #F7AC3B",
+"3 c #F09F32",
+"4 c #DD7F1E",
+"5 c #C36110",
+"6 c #A2A2A2",
+"7 c #F2F3F0",
+"8 c #B9BBC8",
+"9 c #3E3F8E",
+"0 c #545592",
+"a c #535491",
+"b c #525290",
+"c c #515190",
+"d c #52528F",
+"e c #51518F",
+"f c #50508F",
+"g c #51518E",
+"h c #53548D",
+"i c #52538D",
+"j c #795659",
+"k c #CF6005",
+"l c #EE9C2F",
+"m c #F8AC3D",
+"n c #F79A38",
+"o c #F79537",
+"p c #F79938",
+"q c #F8A63B",
+"r c #E9972E",
+"s c #CC5D00",
+"t c #AAAAA9",
+"u c #F0F2EE",
+"v c #A7AAC0",
+"w c #6A6A91",
+"x c #7E7E96",
+"y c #7D7D95",
+"z c #7C7C94",
+"A c #7A7A93",
+"B c #797992",
+"C c #777790",
+"D c #767690",
+"E c #75758F",
+"F c #74748D",
+"G c #73738D",
+"H c #717087",
+"I c #CE660D",
+"J c #EE9C2E",
+"K c #F8A33B",
+"L c #FBD8B7",
+"M c #FFFFFF",
+"N c #FBD5B0",
+"O c #F89E39",
+"P c #E7952B",
+"Q c #CC5C00",
+"R c #AFB0AF",
+"S c #EFF0ED",
+"T c #9697B8",
+"U c #67678C",
+"V c #71718B",
+"W c #70708B",
+"X c #6E6E89",
+"Y c #6D6D88",
+"Z c #6B6B86",
+"` c #AE672B",
+" . c #E1811D",
+".. c #F8AB3C",
+"+. c #FBD5B2",
+"@. c #F8A43A",
+"#. c #DA7A14",
+"$. c #B8B8B7",
+"%. c #EEEFEB",
+"&. c #8284AD",
+"*. c #646488",
+"=. c #6A6A86",
+"-. c #696985",
+";. c #686884",
+">. c #676784",
+",. c #666683",
+"'. c #CA6510",
+"). c #F69130",
+"!. c #FAC796",
+"~. c #FBD4AE",
+"{. c #FAC898",
+"]. c #F79837",
+"^. c #E7962A",
+"/. c #BFBFBE",
+"(. c #ECEDE9",
+"_. c #7173A4",
+":. c #646486",
+"<. c #696986",
+"[. c #676785",
+"}. c #666684",
+"|. c #656583",
+"1. c #646483",
+"2. c #636381",
+"3. c #626281",
+"4. c #616181",
+"5. c #606080",
+"6. c #F7AB3B",
+"7. c #F69132",
+"8. c #F9B97B",
+"9. c #FBCEA3",
+"0. c #F8B778",
+"a. c #F78E2A",
+"b. c #F79333",
+"c. c #EFA033",
+"d. c #CD5B00",
+"e. c #C5C5C3",
+"f. c #EAECE7",
+"g. c #61639D",
+"h. c #5F5F80",
+"i. c #5D5D7F",
+"j. c #5C5C7E",
+"k. c #F8AD3D",
+"l. c #F79434",
+"m. c #F58416",
+"n. c #F6A352",
+"o. c #F9BD82",
+"p. c #F8A85B",
+"q. c #F57900",
+"r. c #F57A01",
+"s. c #F68517",
+"t. c #F7912E",
+"u. c #F1A235",
+"v. c #CACBC9",
+"w. c #E8EAE5",
+"x. c #575998",
+"y. c #606081",
+"z. c #5E5E80",
+"A. c #5C5C7F",
+"B. c #5B5B7E",
+"C. c #5A5A7E",
+"D. c #5A5A7D",
+"E. c #58587C",
+"F. c #545479",
+"G. c #CB5D02",
+"H. c #F6A531",
+"I. c #F78F29",
+"J. c #F68415",
+"K. c #F57A02",
+"L. c #EB9929",
+"M. c #8C8C8C",
+"N. c #CFD0CD",
+"O. c #E7E9E4",
+"P. c #535595",
+"Q. c #5B5B7F",
+"R. c #59597E",
+"S. c #59597D",
+"T. c #58587D",
+"U. c #57577C",
+"V. c #55557C",
+"W. c #474770",
+"X. c #31315F",
+"Y. c #BE5B0C",
+"Z. c #F0921D",
+"`. c #F57E04",
+" + c #F57D04",
+".+ c #E69426",
+"++ c #8E8E8E",
+"@+ c #D3D5D2",
+"#+ c #E5E7E2",
+"$+ c #525393",
+"%+ c #58587F",
+"&+ c #58587E",
+"*+ c #57577D",
+"=+ c #56567D",
+"-+ c #54547C",
+";+ c #53537B",
+">+ c #4D4D76",
+",+ c #393967",
+"'+ c #313160",
+")+ c #313161",
+"!+ c #744334",
+"~+ c #D87814",
+"{+ c #F79116",
+"]+ c #EC9222",
+"^+ c #D87712",
+"/+ c #8E8E8D",
+"(+ c #D8D8D6",
+"_+ c #E3E6E0",
+":+ c #505192",
+"<+ c #54547D",
+"[+ c #52527B",
+"}+ c #4F4F79",
+"|+ c #41416E",
+"1+ c #353565",
+"2+ c #343465",
+"3+ c #353566",
+"4+ c #353567",
+"5+ c #BA580D",
+"6+ c #EA9020",
+"7+ c #F6870D",
+"8+ c #F58A13",
+"9+ c #D88B26",
+"0+ c #DCDDDA",
+"a+ c #E1E4DE",
+"b+ c #4C4D90",
+"c+ c #51517C",
+"d+ c #50507C",
+"e+ c #50507B",
+"f+ c #4E4E7B",
+"g+ c #464674",
+"h+ c #39396B",
+"i+ c #373769",
+"j+ c #38386A",
+"k+ c #3A3A6C",
+"l+ c #544058",
+"m+ c #C65A04",
+"n+ c #E38E23",
+"o+ c #F79117",
+"p+ c #EF9425",
+"q+ c #DC9433",
+"r+ c #C65B05",
+"s+ c #8A8A89",
+"t+ c #DFE0DE",
+"u+ c #DFE1DC",
+"v+ c #48498E",
+"w+ c #4B4B7A",
+"x+ c #444474",
+"y+ c #3C3C6F",
+"z+ c #3B3B6D",
+"A+ c #3B3B6E",
+"B+ c #3C3C6E",
+"C+ c #3C3C70",
+"D+ c #3D3D70",
+"E+ c #3D3D71",
+"F+ c #3E3E71",
+"G+ c #3E3E72",
+"H+ c #533F55",
+"I+ c #AF5313",
+"J+ c #D17518",
+"K+ c #DD8C25",
+"L+ c #EC9727",
+"M+ c #F19927",
+"N+ c #E09029",
+"O+ c #DD912E",
+"P+ c #D0802B",
+"Q+ c #C66D25",
+"R+ c #765D47",
+"S+ c #E3E3E1",
+"T+ c #DCE0D9",
+"U+ c #41418B",
+"V+ c #404072",
+"W+ c #3F3F73",
+"X+ c #404074",
+"Y+ c #404075",
+"Z+ c #414175",
+"`+ c #414176",
+" @ c #424276",
+".@ c #424277",
+"+@ c #434378",
+"@@ c #6E433A",
+"#@ c #A04F19",
+"$@ c #C15706",
+"%@ c #CB5A00",
+"&@ c #BF5706",
+"*@ c #B05F24",
+"=@ c #B18762",
+"-@ c #CCCECB",
+";@ c #585958",
+">@ c #848584",
+",@ c #E5E6E3",
+"'@ c #DBDED6",
+")@ c #3C3C88",
+"!@ c #444479",
+"~@ c #44447A",
+"{@ c #45457B",
+"]@ c #46467C",
+"^@ c #47477D",
+"/@ c #47477E",
+"(@ c #48487E",
+"_@ c #48487F",
+":@ c #49497F",
+"<@ c #3D3D7E",
+"[@ c #8183AA",
+"}@ c #CFD2CC",
+"|@ c #D1D2CF",
+"1@ c #575756",
+"2@ c #808180",
+"3@ c #E7E9E6",
+"4@ c #D9DCD5",
+"5@ c #383987",
+"6@ c #46467D",
+"7@ c #494980",
+"8@ c #4A4A81",
+"9@ c #4B4B82",
+"0@ c #4B4B83",
+"a@ c #4C4C84",
+"b@ c #4D4D85",
+"c@ c #454583",
+"d@ c #7073A3",
+"e@ c #CDD1CB",
+"f@ c #D3D6D1",
+"g@ c #525252",
+"h@ c #EAEBE8",
+"i@ c #D7DAD2",
+"j@ c #202184",
+"k@ c #3B3C87",
+"l@ c #3B3C88",
+"m@ c #3B3B88",
+"n@ c #3B3C89",
+"o@ c #3C3C89",
+"p@ c #3C3C8A",
+"q@ c #3C3D8A",
+"r@ c #3D3D8A",
+"s@ c #373889",
+"t@ c #66689F",
+"u@ c #CBCFC8",
+"v@ c #D7D9D5",
+"w@ c #4D4D4D",
+"x@ c #787878",
+"y@ c #EAECE9",
+"z@ c #D1D4CE",
+"A@ c #CED2CA",
+"B@ c #CED1CA",
+"C@ c #CDD1C9",
+"D@ c #CDD0C9",
+"E@ c #CCD0C8",
+"F@ c #CCCFC8",
+"G@ c #CBCFC7",
+"H@ c #CBCEC7",
+"I@ c #CACEC6",
+"J@ c #AEB0AB",
+"K@ c #B3B6AF",
+"L@ c #C9CCC5",
+"M@ c #C8CCC4",
+"N@ c #C8CBC4",
+"O@ c #C7CBC4",
+"P@ c #C7CAC3",
+"Q@ c #C6CAC3",
+"R@ c #C6C9C3",
+"S@ c #C5C9C3",
+"T@ c #C5C8C2",
+"U@ c #C4C8C2",
+"V@ c #C5C9C2",
+"W@ c #D9DBD7",
+"X@ c #4A4A4A",
+"Y@ c #D4D6D2",
+"Z@ c #EBECE9",
+"`@ c #EAECE8",
+" # c #E9EBE7",
+".# c #E8EAE6",
+"+# c #E7E9E5",
+"@# c #E6E8E5",
+"## c #E6E8E4",
+"$# c #E5E7E3",
+"%# c #E4E6E2",
+"&# c #E3E6E1",
+"*# c #E2E5E1",
+"=# c #E2E4E0",
+"-# c #E1E3DF",
+";# c #E0E2DE",
+"># c #DFE2DD",
+",# c #DEE1DC",
+"'# c #DEE0DC",
+")# c #DDDFDB",
+"!# c #DCDEDA",
+"~# c #C0C2BE",
+"{# c #4D4D4C",
+"]# c #747474",
+"^# c #6E6E6E",
+"/# c #6C6C6C",
+"(# c #6A6A6A",
+"_# c #686868",
+":# c #676767",
+"<# c #656565",
+"[# c #636363",
+"}# c #616161",
+"|# c #5F5F5F",
+"1# c #5E5E5E",
+"2# c #5C5C5C",
+"3# c #5A5A5A",
+"4# c #585858",
+"5# c #565656",
+"6# c #555555",
+"7# c #535353",
+"8# c #515151",
+"9# c #4F4F4F",
+"0# c #4C4C4C",
+"a# c #484848",
+"b# c #4F504E",
+"c# c #838581",
+"d# c #ACAFA9",
+"e# c #ADB0AA",
+"f# c #8B8E89",
+"g# c #8D908C",
+"h# c #ABADAA",
+"i# c #A7A7A6",
+"j# c #A1A1A0",
+"k# c #7C7D7C",
+"l# c #525451",
+"m# c #9B9E9A",
+"n# c #AFB2AC",
+"o# c #B1B3AE",
+"p# c #AEB1AB",
+"q# c #A8AAA5",
+"r# c #9D9F9D",
+"s# c #939392",
+"t# c #A1A1A1",
+"u# c #A5A5A5",
+"v# c #A8A8A8",
+"w# c #595959",
+"x# c #595958",
+"y# c #585857",
+"z# c #575757",
+"A# c #515150",
+"B# c #505050",
+"C# c #4E4E4E",
+"D# c #AAAAAA",
+"E# c #A7A7A7",
+"F# c #ACACAC",
+"G# c #DCE0D8",
+"H# c #DFE3DB",
+"I# c #DFE3DA",
+"J# c #E0E3DA",
+"K# c #E0E3DB",
+"L# c #E1E3DB",
+"M# c #E0E4DB",
+"N# c #E0E4DC",
+"O# c #E1E4DB",
+"P# c #E1E4DC",
+"Q# c #DDE2D9",
+"R# c #545654",
+"S# c #949693",
+"T# c #9F9F9E",
+"U# c #9D9D9D",
+"V# c #9A9B9A",
+"W# c #DADDD5",
+"X# c #9B9B9A",
+"Y# c #9B9B9B",
+"Z# c #9A9B99",
+"`# c #959792",
+" $ c #636463",
+".$ c #BBBDB8",
+"+$ c #9FA09F",
+"@$ c #9C9D9C",
+"#$ c #C9CCC6",
+"$$ c #A0A19F",
+"%$ c #BCC0B9",
+"&$ c #5C5D5C",
+"*$ c #ABABAB",
+"=$ c #676867",
+"-$ c #BDC0BC",
+";$ c #A7A9A6",
+">$ c #AEAEAE",
+",$ c #ACACAB",
+"'$ c #A4A4A3",
+")$ c #B1B2B0",
+"!$ c #B4B6B1",
+"~$ c #AAABAA",
+"{$ c #BEC1BC",
+"]$ c #606160",
+"^$ c #A4A7A2",
+"/$ c #959991",
+"($ c #7A7D77",
+"_$ c #A3A6A0",
+":$ c #777874",
+"<$ c #858782",
+"[$ c #989B94",
+"}$ c #989B95",
+"|$ c #D2D4CD",
+"1$ c #868983",
+"2$ c #848882",
+"3$ c #9EA19A",
+"4$ c #A6A9A4",
+"5$ c #D4D9D1",
+"6$ c #E0E5DC",
+"7$ c #E1E5DE",
+"8$ c #E2E5DE",
+"9$ c #E1E6DD",
+"0$ c #E2E6DE",
+"a$ c #E1E6DF",
+"b$ c #E2E7DE",
+"c$ c #E2E7DD",
+"d$ c #E3E7DE",
+"e$ c #E3E8DE",
+"f$ c #E3E8DF",
+"g$ c #E4E8DF",
+"h$ c #E5E8E0",
+"i$ c #E4E9E0",
+"j$ c #E5E9E0",
+"k$ c #E5E9E1",
+"l$ c #DCE1D9",
+"m$ c #575857",
+"n$ c #5A5B5A",
+"o$ c #595A59",
+"p$ c #555655",
+"q$ c #535453",
+"r$ c #525352",
+"s$ c #515251",
+"t$ c #525251",
+"u$ c #535352",
+"v$ c #545453",
+"w$ c #4D4E4D",
+" . + @ @ @ @ @ @ @ @ @ @ # $ % & * = - ; > , ' ) ! ~ ",
+" { ] ^ ^ ^ ^ ^ ^ / / / / ( ( _ _ : < [ } | 1 2 3 4 5 ",
+" 6 7 8 9 0 0 a b c d e f g h i j k l m n o o o p q r s ",
+" t u v w x y z A B C D E F G H I J K o o L M N o o O P Q ",
+" R S T U D E F G V W X Y Y Z ` ...o o o L M +.o o o @.#. ",
+" $.%.&.*.X Y Y Z =.-.;.>.,.,.'.3 p o o ).!.~.{.o o o ].^., ",
+" /.(._.:.<.[.>.}.|.1.2.3.4.5.' 6.o o o 7.8.9.0.a.b.o o c.d.",
+" e.f.g.:.1.1.3.4.4.h.h.i.i.j., k.o o l.m.n.o.p.q.r.s.t.u., ",
+" v.w.x.4.y.h.z.A.A.B.C.D.E.F.G.H.I.J.K.q.q.q.q.q.q.q.q.L., ",
+" M.N.O.P.A.Q.Q.R.S.T.U.U.V.W.X.Y.Z.`.q.q.q.o.M 8.q.q.q. +.+, ",
+" ++(a)+#+$+%+&+*+=+V.-+;+>+,+'+)+!+~+{+q.q.q.o.M 8.q.q.q.]+^+ ",
+" /+(+_+:+<+-+-+[+[+}+|+1+2+3+3+4+5+6+7+q.q.q.q.q.q.q.8+9+, ",
+" # 0+a+b+c+d+e+f+g+h+i+j+j+h+h+k+l+m+n+o+ +q.q.q. +p+q+r+ ",
+" s+t+u+v+f+w+x+y+z+A+B+y+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+ ",
+" & S+T+U+V+E+G+G+W+W+X+X+Y+Z+`+ @.@.@+@@@#@$@%@&@*@=@-@;@ ",
+" >@,@'@)@`+ @.@.@+@+@!@!@~@{@{@]@]@^@^@/@(@_@:@<@[@}@|@1@ ",
+" 2@3@4@5@{@]@]@6@^@/@(@_@:@7@7@8@8@9@9@0@a@a@b@c@d@e@f@g@ ",
+" ~ h@i@j@k@l@m@m@l@n@o@o@o@n@n@o@p@q@q@q@r@q@q@s@t@u@v@w@ ",
+" x@y@z@A@B@C@D@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@ ",
+" x@Y@Z@Z@`@h@ #.#.#+#@###$##+%#&#*#=#-#-#;#>#,#'#)#!#~#{# ",
+" ]#^#/#(#_#:#<#[#}#|#1#2#3#4#5#6#7#8#9#w@0#X@a#a#a#w@ ",
+" b#c#d#e#f#f#f#f#f#g#h#i#j#k# ",
+" l#m#n#o#n#p#e#e#p#p#e#q#r#s#6 t#u#v#u# ",
+" _#[#}#|#1#2#w#4#x#w#y#z#6#7#8#A#B#9#w@0#0#0#w@C#<#D#E#F# ",
+" [#G#H#H#I#H#H#J#K#J#K#L#M#M#M#N#N#M#N#M#N#O#P#Q#R# v#D#",
+" S#T#U#U#U#U#U#U#U#U#U#U#U#U#U#U#U#U#V#W#X#Y#Y#Z#`# 6 v#",
+" $.$u#u#u#+$@$@$@$@$@$@$@$@$@$@$u#u#u#u##$$$u#u#u#%$&$E#*$ ",
+" =$-$D#D#D#;$>$>$>$>$>$>$>$>$>$,$'$>$>$>$)$!$~$D#D#{$]$ ",
+" ^$/$($($($_$:$:$:$:$:$:$:$:$:$<$[$($($($}$|$1$2$2$3$4$ ",
+" |#5$N#N#6$6$7$8$9$0$9$a$b$b$c$b$d$e$f$g$g$h$i$j$i$i$k$l$8# ",
+" w#m$n$o$m$p$q$r$r$r$s$s$s$s$t$t$t$t$t$t$t$t$u$u$u$u$v$B#w$ ",
+" "};
Added: trunk/gtk/src/icons/pkg-installed.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-installed.xpm?…
==============================================================================
--- trunk/gtk/src/icons/pkg-installed.xpm (added)
+++ trunk/gtk/src/icons/pkg-installed.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,558 @@
+/* XPM */
+static const char * pkg_installed_xpm[] = {
+"32 32 523 2",
+" c None",
+". c #949594",
+"+ c #909090",
+"@ c #8F8F8F",
+"# c #8D8D8D",
+"$ c #8B8B8B",
+"% c #898989",
+"& c #878787",
+"* c #868686",
+"= c #848484",
+"- c #828282",
+"; c #808080",
+"> c #7E7E7E",
+", c #7D7D7D",
+"' c #7B7B7B",
+") c #797979",
+"! c #777777",
+"~ c #7C7C7C",
+"{ c #959595",
+"] c #F1F2EF",
+"^ c #F5F6F3",
+"/ c #F4F5F3",
+"( c #F4F5F2",
+"_ c #F4F4F2",
+": c #F3F4F2",
+"< c #F3F4F1",
+"[ c #F2F4F1",
+"} c #F2F3F1",
+"| c #EDEEEB",
+"1 c #A2A2A2",
+"2 c #F2F3F0",
+"3 c #B9BBC8",
+"4 c #3E3F8E",
+"5 c #545592",
+"6 c #535491",
+"7 c #525290",
+"8 c #515190",
+"9 c #52528F",
+"0 c #51518F",
+"a c #50508F",
+"b c #51518E",
+"c c #53548D",
+"d c #52538D",
+"e c #52528B",
+"f c #51518B",
+"g c #53538D",
+"h c #55568E",
+"i c #54548E",
+"j c #55558E",
+"k c #54548D",
+"l c #535494",
+"m c #D4D7D0",
+"n c #EEF0ED",
+"o c #858685",
+"p c #AAAAA9",
+"q c #F0F2EE",
+"r c #A7AAC0",
+"s c #6A6A91",
+"t c #7E7E96",
+"u c #7D7D95",
+"v c #7C7C94",
+"w c #7A7A93",
+"x c #797992",
+"y c #777790",
+"z c #767690",
+"A c #75758F",
+"B c #74748D",
+"C c #73738D",
+"D c #71718B",
+"E c #70708B",
+"F c #6F6F8A",
+"G c #6D6D88",
+"H c #6B6B86",
+"I c #6A6A85",
+"J c #696985",
+"K c #494A8B",
+"L c #A4A5A2",
+"M c #CFD1CF",
+"N c #8D8E8D",
+"O c #AFB0AF",
+"P c #EFF0ED",
+"Q c #9697B8",
+"R c #67678C",
+"S c #6E6E89",
+"T c #686884",
+"U c #676783",
+"V c #666683",
+"W c #656582",
+"X c #646482",
+"Y c #636380",
+"Z c #626280",
+"` c #454688",
+" . c #D3D6CF",
+".. c #EAECE8",
+"+. c #959695",
+"@. c #B8B8B7",
+"#. c #EEEFEB",
+"$. c #8284AD",
+"%. c #646488",
+"&. c #6A6A86",
+"*. c #676784",
+"=. c #646481",
+"-. c #616180",
+";. c #61617F",
+">. c #5F5F7F",
+",. c #5F5F7E",
+"'. c #535375",
+"). c #3F4084",
+"!. c #B2B4B0",
+"~. c #B7B8B7",
+"{. c #9B9C9B",
+"]. c #BFBFBE",
+"^. c #ECEDE9",
+"/. c #7173A4",
+"(. c #646486",
+"_. c #696986",
+":. c #676785",
+"<. c #666684",
+"[. c #656583",
+"}. c #646483",
+"|. c #636381",
+"1. c #626281",
+"2. c #616181",
+"3. c #606080",
+"4. c #60607F",
+"5. c #5E5E7E",
+"6. c #5B5B7D",
+"7. c #49496E",
+"8. c #36365F",
+"9. c #292954",
+"0. c #242450",
+"a. c #373880",
+"b. c #D2D5CE",
+"c. c #E5E7E3",
+"d. c #A4A5A3",
+"e. c #C5C5C3",
+"f. c #EAECE7",
+"g. c #61639D",
+"h. c #5F5F80",
+"i. c #5D5D7F",
+"j. c #5C5C7E",
+"k. c #565679",
+"l. c #3E3E66",
+"m. c #2A2A56",
+"n. c #272754",
+"o. c #282855",
+"p. c #34357E",
+"q. c #B8BBB6",
+"r. c #ACADAB",
+"s. c #CACBC9",
+"t. c #E8EAE5",
+"u. c #575998",
+"v. c #606081",
+"w. c #5E5E80",
+"x. c #5C5C7F",
+"y. c #5B5B7E",
+"z. c #5A5A7E",
+"A. c #5A5A7D",
+"B. c #58587C",
+"C. c #545479",
+"D. c #3F3F69",
+"E. c #2C2C59",
+"F. c #2A2A58",
+"G. c #2B2B59",
+"H. c #2B2B5A",
+"I. c #2C2C5A",
+"J. c #2C2C5B",
+"K. c #30317C",
+"L. c #D0D4CD",
+"M. c #E0E2DD",
+"N. c #B0B1AF",
+"O. c #8C8C8C",
+"P. c #CFD0CD",
+"Q. c #E7E9E4",
+"R. c #535595",
+"S. c #5B5B7F",
+"T. c #59597E",
+"U. c #59597D",
+"V. c #58587D",
+"W. c #57577C",
+"X. c #55557C",
+"Y. c #474770",
+"Z. c #31315F",
+"`. c #2D2D5C",
+" + c #2E2E5D",
+".+ c #2F2F5E",
+"++ c #2F2F5F",
+"@+ c #30305F",
+"#+ c #303060",
+"$+ c #2D2D7B",
+"%+ c #BFC1BC",
+"&+ c #A4A4A3",
+"*+ c #B6B7B5",
+"=+ c #5D5D5D",
+"-+ c #8E8E8E",
+";+ c #D3D5D2",
+">+ c #E5E7E2",
+",+ c #525393",
+"'+ c #58587F",
+")+ c #58587E",
+"!+ c #57577D",
+"~+ c #56567D",
+"{+ c #54547C",
+"]+ c #53537B",
+"^+ c #4D4D76",
+"/+ c #393967",
+"(+ c #313160",
+"_+ c #313161",
+":+ c #323262",
+"<+ c #333363",
+"[+ c #333364",
+"}+ c #343465",
+"|+ c #2E2E7A",
+"1+ c #C5C9C7",
+"2+ c #DBDDD8",
+"3+ c #BBBCB9",
+"4+ c #5E5E5E",
+"5+ c #8E8E8D",
+"6+ c #D8D8D6",
+"7+ c #E3E6E0",
+"8+ c #505192",
+"9+ c #54547D",
+"0+ c #52527B",
+"a+ c #4F4F79",
+"b+ c #41416E",
+"c+ c #353565",
+"d+ c #353566",
+"e+ c #353567",
+"f+ c #363667",
+"g+ c #363668",
+"h+ c #373768",
+"i+ c #373769",
+"j+ c #383869",
+"k+ c #38386A",
+"l+ c #303078",
+"m+ c #B8BCC3",
+"n+ c #D8DBD5",
+"o+ c #C0C1BE",
+"p+ c #606060",
+"q+ c #DCDDDA",
+"r+ c #E1E4DE",
+"s+ c #4C4D90",
+"t+ c #51517C",
+"u+ c #50507C",
+"v+ c #50507B",
+"w+ c #4E4E7B",
+"x+ c #464674",
+"y+ c #39396B",
+"z+ c #3A3A6C",
+"A+ c #3A3A6D",
+"B+ c #3B3B6D",
+"C+ c #3B3B6E",
+"D+ c #3C3C6F",
+"E+ c #3C3C70",
+"F+ c #313179",
+"G+ c #ADB0BD",
+"H+ c #D5D9D3",
+"I+ c #C4C6C2",
+"J+ c #8A8A89",
+"K+ c #DFE0DE",
+"L+ c #DFE1DC",
+"M+ c #48498E",
+"N+ c #4B4B7A",
+"O+ c #444474",
+"P+ c #3C3C6E",
+"Q+ c #3D3D70",
+"R+ c #3D3D71",
+"S+ c #3E3E71",
+"T+ c #3E3E72",
+"U+ c #3F3F73",
+"V+ c #404074",
+"W+ c #404075",
+"X+ c #323277",
+"Y+ c #A0A3B9",
+"Z+ c #D4D6D0",
+"`+ c #C8CAC7",
+" @ c #5E5E5C",
+".@ c #E3E3E1",
+"+@ c #DCE0D9",
+"@@ c #41418B",
+"#@ c #404072",
+"$@ c #414175",
+"%@ c #414176",
+"&@ c #424276",
+"*@ c #424277",
+"=@ c #434378",
+"-@ c #434379",
+";@ c #444479",
+">@ c #44447A",
+",@ c #45457A",
+"'@ c #36367B",
+")@ c #9193B1",
+"!@ c #D1D5CF",
+"~@ c #CCCECB",
+"{@ c #585958",
+"]@ c #848584",
+"^@ c #E5E6E3",
+"/@ c #DBDED6",
+"(@ c #3C3C88",
+"_@ c #45457B",
+":@ c #46467C",
+"<@ c #47477D",
+"[@ c #47477E",
+"}@ c #48487E",
+"|@ c #48487F",
+"1@ c #49497F",
+"2@ c #3D3D7E",
+"3@ c #8183AA",
+"4@ c #CFD2CC",
+"5@ c #D1D2CF",
+"6@ c #575756",
+"7@ c #808180",
+"8@ c #E7E9E6",
+"9@ c #D9DCD5",
+"0@ c #383987",
+"a@ c #46467D",
+"b@ c #494980",
+"c@ c #4A4A81",
+"d@ c #4B4B82",
+"e@ c #4B4B83",
+"f@ c #4C4C84",
+"g@ c #4D4D85",
+"h@ c #454583",
+"i@ c #7073A3",
+"j@ c #CDD1CB",
+"k@ c #D3D6D1",
+"l@ c #525252",
+"m@ c #EAEBE8",
+"n@ c #D7DAD2",
+"o@ c #202184",
+"p@ c #3B3C87",
+"q@ c #3B3C88",
+"r@ c #3B3B88",
+"s@ c #3B3C89",
+"t@ c #3C3C89",
+"u@ c #3C3C8A",
+"v@ c #3C3D8A",
+"w@ c #3D3D8A",
+"x@ c #373889",
+"y@ c #66689F",
+"z@ c #CBCFC8",
+"A@ c #D7D9D5",
+"B@ c #4D4D4D",
+"C@ c #787878",
+"D@ c #EAECE9",
+"E@ c #D1D4CE",
+"F@ c #CED2CA",
+"G@ c #CED1CA",
+"H@ c #CDD1C9",
+"I@ c #CDD0C9",
+"J@ c #CCD0C8",
+"K@ c #CCCFC8",
+"L@ c #CBCFC7",
+"M@ c #CBCEC7",
+"N@ c #CACEC6",
+"O@ c #AEB0AB",
+"P@ c #B3B6AF",
+"Q@ c #C9CCC5",
+"R@ c #C8CCC4",
+"S@ c #C8CBC4",
+"T@ c #C7CBC4",
+"U@ c #C7CAC3",
+"V@ c #C6CAC3",
+"W@ c #C6C9C3",
+"X@ c #C5C9C3",
+"Y@ c #C5C8C2",
+"Z@ c #C4C8C2",
+"`@ c #C5C9C2",
+" # c #D9DBD7",
+".# c #4A4A4A",
+"+# c #D4D6D2",
+"@# c #EBECE9",
+"## c #E9EBE7",
+"$# c #E8EAE6",
+"%# c #E7E9E5",
+"&# c #E6E8E5",
+"*# c #E6E8E4",
+"=# c #E4E6E2",
+"-# c #E3E6E1",
+";# c #E2E5E1",
+"># c #E2E4E0",
+",# c #E1E3DF",
+"'# c #E0E2DE",
+")# c #DFE2DD",
+"!# c #DEE1DC",
+"~# c #DEE0DC",
+"{# c #DDDFDB",
+"]# c #DCDEDA",
+"^# c #C0C2BE",
+"/# c #4D4D4C",
+"(# c #747474",
+"_# c #6E6E6E",
+":# c #6C6C6C",
+"<# c #6A6A6A",
+"[# c #686868",
+"}# c #676767",
+"|# c #656565",
+"1# c #636363",
+"2# c #616161",
+"3# c #5F5F5F",
+"4# c #5C5C5C",
+"5# c #5A5A5A",
+"6# c #585858",
+"7# c #565656",
+"8# c #555555",
+"9# c #535353",
+"0# c #515151",
+"a# c #4F4F4F",
+"b# c #4C4C4C",
+"c# c #484848",
+"d# c #4F504E",
+"e# c #838581",
+"f# c #ACAFA9",
+"g# c #ADB0AA",
+"h# c #8B8E89",
+"i# c #8D908C",
+"j# c #ABADAA",
+"k# c #A7A7A6",
+"l# c #A1A1A0",
+"m# c #7C7D7C",
+"n# c #525451",
+"o# c #9B9E9A",
+"p# c #AFB2AC",
+"q# c #B1B3AE",
+"r# c #AEB1AB",
+"s# c #A8AAA5",
+"t# c #9D9F9D",
+"u# c #939392",
+"v# c #A1A1A1",
+"w# c #A5A5A5",
+"x# c #A8A8A8",
+"y# c #595959",
+"z# c #595958",
+"A# c #585857",
+"B# c #575757",
+"C# c #515150",
+"D# c #505050",
+"E# c #4E4E4E",
+"F# c #AAAAAA",
+"G# c #A7A7A7",
+"H# c #ACACAC",
+"I# c #DCE0D8",
+"J# c #DFE3DB",
+"K# c #DFE3DA",
+"L# c #E0E3DA",
+"M# c #E0E3DB",
+"N# c #E1E3DB",
+"O# c #E0E4DB",
+"P# c #E0E4DC",
+"Q# c #E1E4DB",
+"R# c #E1E4DC",
+"S# c #DDE2D9",
+"T# c #545654",
+"U# c #949693",
+"V# c #9F9F9E",
+"W# c #9D9D9D",
+"X# c #9A9B9A",
+"Y# c #DADDD5",
+"Z# c #9B9B9A",
+"`# c #9B9B9B",
+" $ c #9A9B99",
+".$ c #959792",
+"+$ c #636463",
+"@$ c #BBBDB8",
+"#$ c #9FA09F",
+"$$ c #9C9D9C",
+"%$ c #C9CCC6",
+"&$ c #A0A19F",
+"*$ c #BCC0B9",
+"=$ c #5C5D5C",
+"-$ c #ABABAB",
+";$ c #676867",
+">$ c #BDC0BC",
+",$ c #A7A9A6",
+"'$ c #AEAEAE",
+")$ c #ACACAB",
+"!$ c #B1B2B0",
+"~$ c #B4B6B1",
+"{$ c #AAABAA",
+"]$ c #BEC1BC",
+"^$ c #606160",
+"/$ c #A4A7A2",
+"($ c #959991",
+"_$ c #7A7D77",
+":$ c #A3A6A0",
+"<$ c #777874",
+"[$ c #858782",
+"}$ c #989B94",
+"|$ c #989B95",
+"1$ c #D2D4CD",
+"2$ c #868983",
+"3$ c #848882",
+"4$ c #9EA19A",
+"5$ c #A6A9A4",
+"6$ c #D4D9D1",
+"7$ c #E0E5DC",
+"8$ c #E1E5DE",
+"9$ c #E2E5DE",
+"0$ c #E1E6DD",
+"a$ c #E2E6DE",
+"b$ c #E1E6DF",
+"c$ c #E2E7DE",
+"d$ c #E2E7DD",
+"e$ c #E3E7DE",
+"f$ c #E3E8DE",
+"g$ c #E3E8DF",
+"h$ c #E4E8DF",
+"i$ c #E5E8E0",
+"j$ c #E4E9E0",
+"k$ c #E5E9E0",
+"l$ c #E5E9E1",
+"m$ c #DCE1D9",
+"n$ c #575857",
+"o$ c #5A5B5A",
+"p$ c #595A59",
+"q$ c #555655",
+"r$ c #535453",
+"s$ c #525352",
+"t$ c #515251",
+"u$ c #525251",
+"v$ c #535352",
+"w$ c #545453",
+"x$ c #4D4E4D",
+" . + @ @ @ @ @ @ @ @ @ @ # $ % & * = - ; > , ' ) ! ~ ",
+" { ] ^ ^ ^ ^ ^ ^ / / / / ( ( _ _ : : : < < < [ } | ) ",
+" 1 2 3 4 5 5 6 7 8 9 0 a b c d e f g h i j k l m n o ",
+" p q r s t u v w x y z A B C D E F G G H I J K L M N ",
+" O P Q R z A B C D E S G G H I T U V W X Y Z ` ...+. ",
+" @.#.$.%.S G G H &.J T *.V V =.=.Z -.;.>.,.'.).!.~.{. ",
+" ].^./.(._.:.*.<.[.}.|.1.2.3.4.>.5.6.7.8.9.0.a.b.c.d. ",
+" e.f.g.(.}.}.1.2.2.h.h.i.i.j.6.k.l.m.n.n.o.o.p.q.r.r. ",
+" s.t.u.2.v.h.w.x.x.y.z.A.B.C.D.E.F.G.G.H.I.J.K.L.M.N. ",
+" O.P.Q.R.x.S.S.T.U.V.W.W.X.Y.Z.`. + +.+.+++@+#+$+%+&+*+=+ ",
+" -+;+>+,+'+)+!+~+X.{+]+^+/+(+_+_+:+:+<+[+[+}+}+|+1+2+3+4+ ",
+" 5+6+7+8+9+{+{+0+0+a+b+c+}+d+d+e+f+g+h+i+j+k+k+l+m+n+o+p+ ",
+" # q+r+s+t+u+v+w+x+y+i+k+k+y+y+z+z+A+B+C+D+D+E+F+G+H+I+4+ ",
+" J+K+L+M+w+N+O+D+B+C+P+D+E+Q+R+S+T+T+U+U+V+V+W+X+Y+Z+`+ @ ",
+" & .@+@@@#@R+T+T+U+U+V+V+W+$@%@&@*@*@=@-@;@>@,@'@)@!@~@{@ ",
+" ]@^@/@(@%@&@*@*@=@=@;@;@>@_@_@:@:@<@<@[@}@|@1@2@3@4@5@6@ ",
+" 7@8@9@0@_@:@:@a@<@[@}@|@1@b@b@c@c@d@d@e@f@f@g@h@i@j@k@l@ ",
+" ~ m@n@o@p@q@r@r@q@s@t@t@t@s@s@t@u@v@v@v@w@v@v@x@y@z@A@B@ ",
+" C@D@E@F@G@H@I@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ #.# ",
+" C@+#@#@#..m@##$#$#%#&#*#c.>+=#-#;#>#,#,#'#)#!#~#{#]#^#/# ",
+" (#_#:#<#[#}#|#1#2#3#4+4#5#6#7#8#9#0#a#B@b#.#c#c#c#B@ ",
+" d#e#f#g#h#h#h#h#h#i#j#k#l#m# ",
+" n#o#p#q#p#r#g#g#r#r#g#s#t#u#1 v#w#x#w# ",
+" [#1#2#3#4+4#y#6#z#y#A#B#8#9#0#C#D#a#B@b#b#b#B@E#|#F#G#H# ",
+" 1#I#J#J#K#J#J#L#M#L#M#N#O#O#O#P#P#O#P#O#P#Q#R#S#T# x#F#",
+" U#V#W#W#W#W#W#W#W#W#W#W#W#W#W#W#W#W#X#Y#Z#`#`# $.$ 1 x#",
+" +$@$w#w#w##$$$$$$$$$$$$$$$$$$$$$w#w#w#w#%$&$w#w#w#*$=$G#-$ ",
+" ;$>$F#F#F#,$'$'$'$'$'$'$'$'$'$)$&+'$'$'$!$~${$F#F#]$^$ ",
+" /$($_$_$_$:$<$<$<$<$<$<$<$<$<$[$}$_$_$_$|$1$2$3$3$4$5$ ",
+" 3#6$P#P#7$7$8$9$0$a$0$b$c$c$d$c$e$f$g$h$h$i$j$k$j$j$l$m$0# ",
+" y#n$o$p$n$q$r$s$s$s$t$t$t$t$u$u$u$u$u$u$u$u$v$v$v$v$w$D#x$ ",
+" "};
Added: trunk/gtk/src/icons/pkg-list-mode.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-list-mode.xpm?…
==============================================================================
--- trunk/gtk/src/icons/pkg-list-mode.xpm (added)
+++ trunk/gtk/src/icons/pkg-list-mode.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,22 @@
+/* XPM */
+static const char * pkg_list_mode_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #000000",
+"+ c #707070",
+" ",
+" ......... ",
+" +++++++++ ",
+" ",
+" ",
+" ............ ",
+" ++++++++++++ ",
+" ",
+" ",
+" ......... ",
+" +++++++++ ",
+" ",
+" ",
+" ............ ",
+" ++++++++++++ ",
+" "};
Added: trunk/gtk/src/icons/pkg-locked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-locked.xpm?rev…
==============================================================================
--- trunk/gtk/src/icons/pkg-locked.xpm (added)
+++ trunk/gtk/src/icons/pkg-locked.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,109 @@
+/* XPM */
+static const char * pkg_locked_xpm[] = {
+"16 16 90 1",
+" c None",
+". c #000000",
+"+ c #1E1E1E",
+"@ c #7A7A7A",
+"# c #D2D2D2",
+"$ c #DBDBDB",
+"% c #BCBCBC",
+"& c #727272",
+"* c #080808",
+"= c #848484",
+"- c #BEBEBE",
+"; c #383838",
+"> c #1C1C1C",
+", c #4D4D4D",
+"' c #B1B1B1",
+") c #2D2D2D",
+"! c #C2C2C2",
+"~ c #090909",
+"{ c #2E2E2E",
+"] c #AAAAAA",
+"^ c #2B2B2B",
+"/ c #C0C0C0",
+"( c #161616",
+"_ c #C1C0C0",
+": c #13110E",
+"< c #9B9794",
+"[ c #201D1C",
+"} c #0B0B07",
+"| c #040302",
+"1 c #050403",
+"2 c #2F2921",
+"3 c #A8A39E",
+"4 c #1A130B",
+"5 c #A59176",
+"6 c #E0C4A0",
+"7 c #DFC4A3",
+"8 c #DABE9A",
+"9 c #D6BA94",
+"0 c #CDA676",
+"a c #815A2B",
+"b c #E2C5A1",
+"c c #D8B58C",
+"d c #CA9F68",
+"e c #AC8758",
+"f c #A78252",
+"g c #A78253",
+"h c #A37B4B",
+"i c #BC8849",
+"j c #AC712E",
+"k c #E3C6A2",
+"l c #D5AE7E",
+"m c #B08D5F",
+"n c #D5B284",
+"o c #CFAB7C",
+"p c #CFAC7B",
+"q c #CBA471",
+"r c #BC8746",
+"s c #AA6F2B",
+"t c #E1C4A0",
+"u c #D0A674",
+"v c #C79B64",
+"w c #AA8455",
+"x c #A47E4E",
+"y c #A07744",
+"z c #BA8442",
+"A c #E1C29C",
+"B c #CEA470",
+"C c #AD8D64",
+"D c #D2B289",
+"E c #CDAC83",
+"F c #CEAD83",
+"G c #CCA77B",
+"H c #B8803E",
+"I c #AD7332",
+"J c #E0C29E",
+"K c #D4AC79",
+"L c #CDA66E",
+"M c #AF8D5E",
+"N c #AB8758",
+"O c #AB8858",
+"P c #A8814C",
+"Q c #B47E3E",
+"R c #D0A874",
+"S c #C6965D",
+"T c #BE8D50",
+"U c #BA894B",
+"V c #BD8C4E",
+"W c #BC8A4C",
+"X c #BA8647",
+"Y c #A47136",
+" ",
+" .... ",
+" +@#$$%&* ",
+" =-;>>,'= ",
+" )!~ {]. ",
+" ^/. (_. ",
+" :<[}||1234 ",
+" .567788890a. ",
+" .bcdeffghij. ",
+" .klmnoopqrs. ",
+" .tuvwxxxyzj. ",
+" .ABCDEEFGHI. ",
+" .JKLMNNOPrQ. ",
+" .RSTTUUVWXY. ",
+" .......... ",
+" "};
Added: trunk/gtk/src/icons/pkg-remove-auto.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-remove-auto.xp…
==============================================================================
--- trunk/gtk/src/icons/pkg-remove-auto.xpm (added)
+++ trunk/gtk/src/icons/pkg-remove-auto.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,424 @@
+/* XPM */
+static const char * pkg_remove_auto_xpm[] = {
+"32 32 389 2",
+" c None",
+". c #8D8E89",
+"+ c #888A85",
+"@ c #8B8D88",
+"# c #8D8F8A",
+"$ c #F3F3F3",
+"% c #F7F7F7",
+"& c #F6F6F6",
+"* c #F5F5F5",
+"= c #F2F2F2",
+"- c #E6E6E6",
+"; c #E5E5E5",
+"> c #E4E4E4",
+", c #E3E3E3",
+"' c #E2E2E2",
+") c #E1E1E1",
+"! c #F4F4F4",
+"~ c #204B88",
+"{ c #234D8A",
+"] c #868A88",
+"^ c #F1F1F1",
+"/ c #CACACA",
+"( c #C3C3C3",
+"_ c #C2C2C2",
+": c #C1C1C1",
+"< c #C8C8C8",
+"[ c #E0E0E0",
+"} c #244E8C",
+"| c #224C89",
+"1 c #5485C5",
+"2 c #598BCB",
+"3 c #7D8181",
+"4 c #DDDDDD",
+"5 c #CECECE",
+"6 c #CDCDCD",
+"7 c #CCCCCC",
+"8 c #CBCBCB",
+"9 c #DEDEDE",
+"0 c #7D7F7A",
+"a c #4C7DBC",
+"b c #214C89",
+"c c #3965A2",
+"d c #6090CD",
+"e c #727676",
+"f c #C9C9C9",
+"g c #BABABA",
+"h c #A6A6A6",
+"i c #9F9F9F",
+"j c #9E9E9E",
+"k c #A4A4A4",
+"l c #B8B8B8",
+"m c #B7B7B7",
+"n c #B6B6B6",
+"o c #727470",
+"p c #325F9C",
+"q c #5B86C1",
+"r c #406492",
+"s c #646763",
+"t c #6B6D69",
+"u c #6A6B67",
+"v c #6D6E6A",
+"w c #395983",
+"x c #224C8A",
+"y c #28528E",
+"z c #769FD4",
+"A c #5A8BCB",
+"B c #3B5D88",
+"C c #243953",
+"D c #243954",
+"E c #263B56",
+"F c #263B57",
+"G c #273D59",
+"H c #273E5A",
+"I c #283E5B",
+"J c #283F5D",
+"K c #29405E",
+"L c #29415F",
+"M c #2A4261",
+"N c #2B4362",
+"O c #2B4463",
+"P c #2C4565",
+"Q c #2D4666",
+"R c #2D4768",
+"S c #2E4869",
+"T c #2E496A",
+"U c #2F4A6C",
+"V c #304B6D",
+"W c #3C5074",
+"X c #5C85C2",
+"Y c #5E8ECC",
+"Z c #2B5793",
+"` c #5179B1",
+" . c #739DD3",
+".. c #5F81BC",
+"+. c #89425D",
+"@. c #AB1213",
+"#. c #AB1314",
+"$. c #884B67",
+"%. c #5477AE",
+"&. c #7499C8",
+"*. c #6794CE",
+"=. c #588ACA",
+"-. c #667AB0",
+";. c #BE4E52",
+">. c #E18080",
+",. c #E17E7E",
+"'. c #B84C52",
+"). c #758BBC",
+"!. c #234D89",
+"~. c #224D8A",
+"{. c #7A9AC5",
+"]. c #5581BA",
+"^. c #4978B5",
+"/. c #4878B5",
+"(. c #4976B2",
+"_. c #704D72",
+":. c #6B5178",
+"<. c #4877B3",
+"[. c #668DC1",
+"}. c #2F5892",
+"|. c #214B88",
+"1. c #587BAB",
+"2. c #809DC2",
+"3. c #819EC3",
+"4. c #809DC3",
+"5. c #7F9DC2",
+"6. c #7E9BC1",
+"7. c #7C9AC1",
+"8. c #7C9AC0",
+"9. c #7A98C0",
+"0. c #7998BF",
+"a. c #7897BE",
+"b. c #7796BE",
+"c. c #7595BD",
+"d. c #7494BD",
+"e. c #7393BC",
+"f. c #7192BB",
+"g. c #7191BB",
+"h. c #7091BB",
+"i. c #6E8FBA",
+"j. c #6D8FBA",
+"k. c #6C8EB9",
+"l. c #6A8CB7",
+"m. c #29518C",
+"n. c #204A85",
+"o. c #204A87",
+"p. c #204986",
+"q. c #898A89",
+"r. c #B8B9B6",
+"s. c #8B8D89",
+"t. c #838581",
+"u. c #C6C6C5",
+"v. c #BDBEBD",
+"w. c #B3B4B3",
+"x. c #B0B0AF",
+"y. c #A9AAA8",
+"z. c #B0B1B0",
+"A. c #C4C5C4",
+"B. c #B1B2B1",
+"C. c #ADADAC",
+"D. c #B6B7B5",
+"E. c #ABACAA",
+"F. c #B5B5B4",
+"G. c #787A76",
+"H. c #9D9E9B",
+"I. c #BFC0BD",
+"J. c #C3C4C3",
+"K. c #7D7F7C",
+"L. c #888985",
+"M. c #848581",
+"N. c #C0C1C0",
+"O. c #BBBBBB",
+"P. c #BCBDBC",
+"Q. c #B4B5B4",
+"R. c #BFC0BF",
+"S. c #BFBFBE",
+"T. c #A4A4A3",
+"U. c #B2B3B2",
+"V. c #C8C8C7",
+"W. c #C6C6C6",
+"X. c #B1B1B0",
+"Y. c #B4B5B3",
+"Z. c #B9B9B8",
+"`. c #7C7D7A",
+" + c #A9AAA6",
+".+ c #C8C8C6",
+"++ c #C0C1BE",
+"@+ c #727371",
+"#+ c #BEBFBC",
+"$+ c #8E908A",
+"%+ c #898B86",
+"&+ c #BDBDBC",
+"*+ c #BEBFBE",
+"=+ c #B6B7B6",
+"-+ c #BEBEBD",
+";+ c #D2D2D2",
+">+ c #A6A7A5",
+",+ c #C7C8C7",
+"'+ c #C9C9C8",
+")+ c #B2B3B1",
+"!+ c #C1C2C1",
+"~+ c #CFCFCF",
+"{+ c #B8B9B8",
+"]+ c #BABAB9",
+"^+ c #B8B9B5",
+"/+ c #D2D3D0",
+"(+ c #BCBDBA",
+"_+ c #686A66",
+":+ c #C4C5C2",
+"<+ c #92948F",
+"[+ c #CBCCCB",
+"}+ c #C4C4C3",
+"|+ c #BDBEBC",
+"1+ c #C3C3C2",
+"2+ c #D3D3D3",
+"3+ c #AFB0AE",
+"4+ c #CDCDCC",
+"5+ c #D1D1D1",
+"6+ c #BBBCBA",
+"7+ c #B7B7B6",
+"8+ c #C5C6C5",
+"9+ c #D6D6D6",
+"0+ c #8F918C",
+"a+ c #BFC0BC",
+"b+ c #D8D9D6",
+"c+ c #B5B7B3",
+"d+ c #C8C9C7",
+"e+ c #999A93",
+"f+ c #92938E",
+"g+ c #D9D9D9",
+"h+ c #C9CAC9",
+"i+ c #C7C7C6",
+"j+ c #BFC0BE",
+"k+ c #DBDBDB",
+"l+ c #BEBFBD",
+"m+ c #C2C2C1",
+"n+ c #D0D0CF",
+"o+ c #DFDFDF",
+"p+ c #C1C2C0",
+"q+ c #C3C4C2",
+"r+ c #CACAC9",
+"s+ c #B6B6B5",
+"t+ c #989994",
+"u+ c #C8C8C4",
+"v+ c #DEDEDC",
+"w+ c #ABADA9",
+"x+ c #C8C9C6",
+"y+ c #9C9E9A",
+"z+ c #91938F",
+"A+ c #EAEAEA",
+"B+ c #D8D8D7",
+"C+ c #D2D2D1",
+"D+ c #A0A09D",
+"E+ c #CFCFCE",
+"F+ c #CBCBCA",
+"G+ c #D6D6D5",
+"H+ c #E0E0DF",
+"I+ c #D1D2D1",
+"J+ c #B2B3B0",
+"K+ c #9EA09B",
+"L+ c #CCCDC9",
+"M+ c #E2E3E0",
+"N+ c #A1A29E",
+"O+ c #555753",
+"P+ c #565854",
+"Q+ c #A0A19E",
+"R+ c #E7E7E6",
+"S+ c #E3E4E3",
+"T+ c #E8E8E8",
+"U+ c #929490",
+"V+ c #DEDEDD",
+"W+ c #D5D5D4",
+"X+ c #DDDEDD",
+"Y+ c #DADAD9",
+"Z+ c #D3D4D2",
+"`+ c #DCDCDC",
+" @ c #D4D5D4",
+".@ c #AAABA8",
+"+@ c #E4E4E3",
+"@@ c #A0A29E",
+"#@ c #D1D2CE",
+"$@ c #E7E7E5",
+"%@ c #90928F",
+"&@ c #575955",
+"*@ c #DBDCDA",
+"=@ c #BABBB9",
+"-@ c #585A56",
+";@ c #EDEDEC",
+">@ c #EFEFEE",
+",@ c #D3D3D2",
+"'@ c #AFB1AB",
+")@ c #C4C4C2",
+"!@ c #E9E9E9",
+"~@ c #D9D9D8",
+"{@ c #E7E7E7",
+"]@ c #D1D2D0",
+"^@ c #D7D8D7",
+"/@ c #EBEBEA",
+"(@ c #F0F0F0",
+"_@ c #9A9B96",
+":@ c #EEEEED",
+"<@ c #D4D5D1",
+"[@ c #EBEBE9",
+"}@ c #838480",
+"|@ c #DCDDDB",
+"1@ c #595B57",
+"2@ c #949591",
+"3@ c #E1E2E1",
+"4@ c #D2D3D1",
+"5@ c #AEAFAC",
+"6@ c #B5B7B1",
+"7@ c #A0A29D",
+"8@ c #BABBB8",
+"9@ c #AEB0AC",
+"0@ c #E2E3E2",
+"a@ c #9D9E99",
+"b@ c #A2A39F",
+"c@ c #B5B6B2",
+"d@ c #D7D8D3",
+"e@ c #767774",
+"f@ c #A9ABA5",
+"g@ c #9FA09B",
+"h@ c #969794",
+"i@ c #BBBDB7",
+"j@ c #B3B5AF",
+"k@ c #959792",
+"l@ c #999A96",
+"m@ c #9B9D98",
+"n@ c #A2A39E",
+"o@ c #ABADA7",
+"p@ c #979995",
+"q@ c #989995",
+"r@ c #9A9C97",
+"s@ c #A6A7A2",
+"t@ c #B2B4AE",
+"u@ c #C8C9C3",
+"v@ c #EBECEA",
+"w@ c #5A5C58",
+"x@ c #DDDEDC",
+"y@ c #B9BBB5",
+"z@ c #CBCDC7",
+"A@ c #D7D8D4",
+"B@ c #DCDDDA",
+"C@ c #C0C1BF",
+"D@ c #CDCEC8",
+"E@ c #D9DAD6",
+"F@ c #E8E8E6",
+"G@ c #C4C5C3",
+"H@ c #AEB0AA",
+"I@ c #C6C8C2",
+"J@ c #DADAD6",
+"K@ c #E3E4E1",
+"L@ c #CCCDCB",
+"M@ c #AFB1AD",
+"N@ c #B0B1AE",
+"O@ c #B0B2AE",
+"P@ c #B1B2AD",
+"Q@ c #B1B3AF",
+"R@ c #B2B3AE",
+"S@ c #B2B4AF",
+"T@ c #B2B3AF",
+"U@ c #B3B4B1",
+"V@ c #B4B5B1",
+"W@ c #B4B5B0",
+"X@ c #B5B6B1",
+"Y@ c #B4B5B2",
+"Z@ c #BEC0BC",
+"`@ c #D3D4D1",
+" # c #D8D9D5",
+".# c #D4D5D3",
+"+# c #C3C4C1",
+"@# c #C7C7C5",
+"## c #C7C7C4",
+"$# c #C6C7C4",
+"%# c #C6C6C3",
+"&# c #C5C6C3",
+"*# c #C5C5C3",
+"=# c #C5C5C2",
+"-# c #C6C6C4",
+";# c #DBDBD9",
+"># c #D7D8D6",
+",# c #D9D9D7",
+"'# c #DDDDDC",
+")# c #DEDFDD",
+"!# c #DFDFDD",
+"~# c #DFDFDE",
+"{# c #5F5F5D",
+"]# c #454744",
+"^# c #414541",
+" ",
+" . + + + + + + + + + + + + + + + + + + @ ",
+" # $ % & & & & & & & & & & & & * * * * + ",
+" @ = - ; > > , , , , , ' ' ' ' ) ' , ! + ",
+" ~ { ] ^ , / ( ( _ _ _ _ _ _ _ _ : : < [ $ + } | ",
+" | 1 2 3 4 5 6 7 8 8 8 8 / 8 7 7 8 8 8 8 / 9 0 2 a b ",
+" c d 2 e f g h i i i i j j k l m m m m m n / o 2 2 p ",
+" { q d r s t u u u u u u u u u u u u u u u u v u w 2 a x ",
+" y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ",
+" | ` .2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ..+.@.#.$.%.{ ",
+" } &.*.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.-.;.>.,.'.).!. ",
+" ~.{.].^.^.^.^.^.^.^.^.^././././././././././././.(._.:.<.[.}. ",
+" |.1.2.3.3.3.3.3.3.3.4.5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m. ",
+" n.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.p. ",
+" q.r.s.t.u.v.v.w._ x.f y.z.A.f B.C.v.5 D.E.F.G.H.I.J. ",
+" K.r.L.M.N.O.P.Q.R.S.5 T.U.V.W.X.X._ 6 Y.C.Z.`. +.+++ ",
+" @+#+$+%+( &+*+=+S.-+;+>+Q.,+'+Y.)+!+~+{+B.]+%+^+/+(+ ",
+" _+:+<+# [+}+A.|+1+-+2+3+{+4+5+6+7+8+9+N.7+v.0+a+b+c+ ",
+" d+e+f+g+4 h+i+4+j+k+l+m+n+o+p+q+r+[ ;+s+m+t+u+v+w+ ",
+" x+y+z+A+4+B+C+, D+, E+F+G+H+F+I+E+> ; J+'+K+L+M+N+ ",
+" O+P+O+O+Q+R+S+T+U+V+[ W+X+Y+Z+`+ @- = .@+@@@#@$@%@ ",
+" &@*@=@-@<+;@>@,@'@)@!@~@{@]@4+{@^@/@(@_@:@3+<@[@}@ ",
+" P+|@6+1@2@3@4@5@6@7@{@,@V+8@9@W+W+3@0@a@b@c@d@[@e@ ",
+" O+|@6+1@f@g@h@'@i@j@k@l@m@n@o@7@p@q@r@s@t@u@d@v@ ",
+"O+O+O+P+w@x@6+w@O+O+O+O+i@i@i@i@y@i@i@i@i@i@i@i@i@z@A@v@ ",
+"O+B@|@x@|@|@C@C@C@C@p+O+i@i@i@i@i@i@i@i@i@i@i@i@i@D@E@F@ ",
+"O+*@G@q+q+q+q+q+q+q+q+O+H@H@H@H@H@H@H@H@H@H@H@H@H@I@J@K@ ",
+"O+O+O+O+O+L@L@-@O+O+O+O+M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ # ",
+" O+.#.#-@+#@#@###$#$#$#$#%#%#&#&#&#&#*#*#=#-#;#(+ ",
+" O+>#>#-@,#'#'#X+V+v+v+v+V+V+)#)#)#!#!#~#~#B@m+{# ",
+" O+Z+Z+P+]#]#]#]#]#]#]#]#]#]#]#]#]#]#]#]#]#]#^# ",
+" P+&@&@P+ "};
Added: trunk/gtk/src/icons/pkg-remove.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-remove.xpm?rev…
==============================================================================
--- trunk/gtk/src/icons/pkg-remove.xpm (added)
+++ trunk/gtk/src/icons/pkg-remove.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,435 @@
+/* XPM */
+static const char * pkg_remove_xpm[] = {
+"32 32 400 2",
+" c None",
+". c #8D8E89",
+"+ c #888A85",
+"@ c #8B8D88",
+"# c #8D8F8A",
+"$ c #F3F3F3",
+"% c #F7F7F7",
+"& c #F6F6F6",
+"* c #F5F5F5",
+"= c #F2F2F2",
+"- c #E6E6E6",
+"; c #E5E5E5",
+"> c #E4E4E4",
+", c #E3E3E3",
+"' c #E2E2E2",
+") c #E1E1E1",
+"! c #F4F4F4",
+"~ c #204B88",
+"{ c #234D8A",
+"] c #868A88",
+"^ c #F1F1F1",
+"/ c #CACACA",
+"( c #C3C3C3",
+"_ c #C2C2C2",
+": c #C1C1C1",
+"< c #C8C8C8",
+"[ c #E0E0E0",
+"} c #244E8C",
+"| c #224C89",
+"1 c #5485C5",
+"2 c #598BCB",
+"3 c #7D8181",
+"4 c #DDDDDD",
+"5 c #CECECE",
+"6 c #CDCDCD",
+"7 c #CCCCCC",
+"8 c #CBCBCB",
+"9 c #DEDEDE",
+"0 c #7D7F7A",
+"a c #4C7DBC",
+"b c #214C89",
+"c c #3965A2",
+"d c #6090CD",
+"e c #727676",
+"f c #C9C9C9",
+"g c #BABABA",
+"h c #A6A6A6",
+"i c #9F9F9F",
+"j c #9E9E9E",
+"k c #A4A4A4",
+"l c #B8B8B8",
+"m c #B7B7B7",
+"n c #B6B6B6",
+"o c #727470",
+"p c #325F9C",
+"q c #5B86C1",
+"r c #406492",
+"s c #646763",
+"t c #6B6D69",
+"u c #6A6B67",
+"v c #6D6E6A",
+"w c #395983",
+"x c #224C8A",
+"y c #28528E",
+"z c #769FD4",
+"A c #5A8BCB",
+"B c #3B5D88",
+"C c #243953",
+"D c #243954",
+"E c #263B56",
+"F c #263B57",
+"G c #273D59",
+"H c #273E5A",
+"I c #283E5B",
+"J c #283F5D",
+"K c #29405E",
+"L c #29415F",
+"M c #2A4261",
+"N c #2B4362",
+"O c #2B4463",
+"P c #2C4565",
+"Q c #2D4666",
+"R c #2D4768",
+"S c #2E4869",
+"T c #2E496A",
+"U c #2F4A6C",
+"V c #304B6D",
+"W c #3C5074",
+"X c #5C85C2",
+"Y c #5E8ECC",
+"Z c #2B5793",
+"` c #5179B1",
+" . c #739DD3",
+".. c #5F81BC",
+"+. c #89425D",
+"@. c #AB1213",
+"#. c #AB1314",
+"$. c #884B67",
+"%. c #5477AE",
+"&. c #7499C8",
+"*. c #6794CE",
+"=. c #588ACA",
+"-. c #667AB0",
+";. c #BE4E52",
+">. c #E18080",
+",. c #E17E7E",
+"'. c #B84C52",
+"). c #758BBC",
+"!. c #234D89",
+"~. c #224D8A",
+"{. c #7A9AC5",
+"]. c #5581BA",
+"^. c #4978B5",
+"/. c #4878B5",
+"(. c #4976B2",
+"_. c #704D72",
+":. c #6B5178",
+"<. c #4877B3",
+"[. c #668DC1",
+"}. c #2F5892",
+"|. c #214B88",
+"1. c #587BAB",
+"2. c #809DC2",
+"3. c #819EC3",
+"4. c #809DC3",
+"5. c #7F9DC2",
+"6. c #7E9BC1",
+"7. c #7C9AC1",
+"8. c #7C9AC0",
+"9. c #7A98C0",
+"0. c #7998BF",
+"a. c #7897BE",
+"b. c #7796BE",
+"c. c #7595BD",
+"d. c #7494BD",
+"e. c #7393BC",
+"f. c #7192BB",
+"g. c #7191BB",
+"h. c #7091BB",
+"i. c #6E8FBA",
+"j. c #6D8FBA",
+"k. c #6C8EB9",
+"l. c #6A8CB7",
+"m. c #29518C",
+"n. c #204A85",
+"o. c #204A87",
+"p. c #204986",
+"q. c #898A89",
+"r. c #B8B9B6",
+"s. c #8B8D89",
+"t. c #838581",
+"u. c #C6C6C5",
+"v. c #BDBEBD",
+"w. c #B3B4B3",
+"x. c #B0B0AF",
+"y. c #A9AAA8",
+"z. c #B0B1B0",
+"A. c #C4C5C4",
+"B. c #B1B2B1",
+"C. c #ADADAC",
+"D. c #B6B7B5",
+"E. c #ABACAA",
+"F. c #B5B5B4",
+"G. c #787A76",
+"H. c #9D9E9B",
+"I. c #BFC0BD",
+"J. c #C3C4C3",
+"K. c #7D7F7C",
+"L. c #888985",
+"M. c #848581",
+"N. c #C0C1C0",
+"O. c #BBBBBB",
+"P. c #BCBDBC",
+"Q. c #B4B5B4",
+"R. c #BFC0BF",
+"S. c #BFBFBE",
+"T. c #A4A4A3",
+"U. c #B2B3B2",
+"V. c #C8C8C7",
+"W. c #C6C6C6",
+"X. c #B1B1B0",
+"Y. c #B4B5B3",
+"Z. c #B9B9B8",
+"`. c #7C7D7A",
+" + c #A9AAA6",
+".+ c #C8C8C6",
+"++ c #C0C1BE",
+"@+ c #727371",
+"#+ c #BEBFBC",
+"$+ c #8E908A",
+"%+ c #898B86",
+"&+ c #BDBDBC",
+"*+ c #BEBFBE",
+"=+ c #B6B7B6",
+"-+ c #BEBEBD",
+";+ c #D2D2D2",
+">+ c #A6A7A5",
+",+ c #C7C8C7",
+"'+ c #C9C9C8",
+")+ c #B2B3B1",
+"!+ c #C1C2C1",
+"~+ c #CFCFCF",
+"{+ c #B8B9B8",
+"]+ c #BABAB9",
+"^+ c #B8B9B5",
+"/+ c #D2D3D0",
+"(+ c #BCBDBA",
+"_+ c #686A66",
+":+ c #C4C5C2",
+"<+ c #92948F",
+"[+ c #CBCCCB",
+"}+ c #C4C4C3",
+"|+ c #BDBEBC",
+"1+ c #C3C3C2",
+"2+ c #D3D3D3",
+"3+ c #AFB0AE",
+"4+ c #CDCDCC",
+"5+ c #D1D1D1",
+"6+ c #BBBCBA",
+"7+ c #B7B7B6",
+"8+ c #C5C6C5",
+"9+ c #D6D6D6",
+"0+ c #8F918C",
+"a+ c #BFC0BC",
+"b+ c #D8D9D6",
+"c+ c #B5B7B3",
+"d+ c #C8C9C7",
+"e+ c #999A93",
+"f+ c #92938E",
+"g+ c #D9D9D9",
+"h+ c #C9CAC9",
+"i+ c #C7C7C6",
+"j+ c #BFC0BE",
+"k+ c #DBDBDB",
+"l+ c #BEBFBD",
+"m+ c #C2C2C1",
+"n+ c #D0D0CF",
+"o+ c #DFDFDF",
+"p+ c #C1C2C0",
+"q+ c #C3C4C2",
+"r+ c #CACAC9",
+"s+ c #B6B6B5",
+"t+ c #989994",
+"u+ c #C8C8C4",
+"v+ c #DEDEDC",
+"w+ c #ABADA9",
+"x+ c #CCCDCA",
+"y+ c #9EA09C",
+"z+ c #929490",
+"A+ c #EAEAEA",
+"B+ c #D8D8D7",
+"C+ c #D2D2D1",
+"D+ c #A0A09D",
+"E+ c #CFCFCE",
+"F+ c #CBCBCA",
+"G+ c #D6D6D5",
+"H+ c #E0E0DF",
+"I+ c #D1D2D1",
+"J+ c #B2B3B0",
+"K+ c #9EA09B",
+"L+ c #CCCDC9",
+"M+ c #E2E3E0",
+"N+ c #A1A29E",
+"O+ c #CACBC8",
+"P+ c #A7A9A3",
+"Q+ c #AEAEAC",
+"R+ c #A3A4A1",
+"S+ c #E7E7E6",
+"T+ c #E3E4E3",
+"U+ c #E8E8E8",
+"V+ c #DEDEDD",
+"W+ c #D5D5D4",
+"X+ c #DDDEDD",
+"Y+ c #DADAD9",
+"Z+ c #D3D4D2",
+"`+ c #DCDCDC",
+" @ c #D4D5D4",
+".@ c #AAABA8",
+"+@ c #E4E4E3",
+"@@ c #A0A29E",
+"#@ c #D1D2CE",
+"$@ c #E7E7E5",
+"%@ c #90928F",
+"&@ c #CACAC8",
+"*@ c #A9ABA7",
+"=@ c #DCDDDC",
+"-@ c #F8F8F8",
+";@ c #959792",
+">@ c #EDEDEC",
+",@ c #EFEFEE",
+"'@ c #D3D3D2",
+")@ c #AFB1AB",
+"!@ c #C4C4C2",
+"~@ c #E9E9E9",
+"{@ c #D9D9D8",
+"]@ c #E7E7E7",
+"^@ c #D1D2D0",
+"/@ c #D7D8D7",
+"(@ c #EBEBEA",
+"_@ c #F0F0F0",
+":@ c #9A9B96",
+"<@ c #EEEEED",
+"[@ c #D4D5D1",
+"}@ c #EBEBE9",
+"|@ c #838480",
+"1@ c #C6C7C4",
+"2@ c #BABCB6",
+"3@ c #A2A4A0",
+"4@ c #989995",
+"5@ c #E1E2E1",
+"6@ c #D2D3D1",
+"7@ c #AEAFAC",
+"8@ c #B5B7B1",
+"9@ c #A0A29D",
+"0@ c #BABBB8",
+"a@ c #AEB0AC",
+"b@ c #E2E3E2",
+"c@ c #9D9E99",
+"d@ c #A2A39F",
+"e@ c #B5B6B2",
+"f@ c #D7D8D3",
+"g@ c #767774",
+"h@ c #C1C2BE",
+"i@ c #BDBFBC",
+"j@ c #A3A5A0",
+"k@ c #9FA19C",
+"l@ c #AEB0AA",
+"m@ c #9FA09B",
+"n@ c #969794",
+"o@ c #BBBDB7",
+"p@ c #B3B5AF",
+"q@ c #999A96",
+"r@ c #9B9D98",
+"s@ c #A2A39E",
+"t@ c #ABADA7",
+"u@ c #979995",
+"v@ c #9A9C97",
+"w@ c #A6A7A2",
+"x@ c #B2B4AE",
+"y@ c #C8C9C3",
+"z@ c #EBECEA",
+"A@ c #BBBCB9",
+"B@ c #C1C3BE",
+"C@ c #B9BBB5",
+"D@ c #CBCDC7",
+"E@ c #D7D8D4",
+"F@ c #C4C5C0",
+"G@ c #CDCEC8",
+"H@ c #D9DAD6",
+"I@ c #E8E8E6",
+"J@ c #AAADA9",
+"K@ c #C7C8C4",
+"L@ c #B4B6B0",
+"M@ c #C6C8C2",
+"N@ c #DADAD6",
+"O@ c #E3E4E1",
+"P@ c #C5C5C3",
+"Q@ c #B2B4AF",
+"R@ c #ADAFAB",
+"S@ c #AEAFAB",
+"T@ c #B0B1AC",
+"U@ c #B0B2AC",
+"V@ c #AFB1AD",
+"W@ c #B0B1AE",
+"X@ c #B0B2AE",
+"Y@ c #B1B2AD",
+"Z@ c #B1B3AF",
+"`@ c #B2B3AE",
+" # c #B2B3AF",
+".# c #B3B4B1",
+"+# c #B4B5B1",
+"@# c #B4B5B0",
+"## c #B5B6B1",
+"$# c #B4B5B2",
+"%# c #BEC0BC",
+"&# c #D3D4D1",
+"*# c #D8D9D5",
+"=# c #6B6D6B",
+"-# c #C7C8C5",
+";# c #C7C7C5",
+"># c #C7C7C4",
+",# c #C6C6C3",
+"'# c #C5C6C3",
+")# c #C5C5C2",
+"!# c #C6C6C4",
+"~# c #DBDBD9",
+"{# c #484946",
+"]# c #B3B3B0",
+"^# c #DCDDDB",
+"/# c #DDDDDB",
+"(# c #DDDDDC",
+"_# c #DEDFDD",
+":# c #DFDFDD",
+"<# c #DFDFDE",
+"[# c #DCDDDA",
+"}# c #5F5F5D",
+"|# c #424442",
+"1# c #454643",
+"2# c #454744",
+"3# c #414541",
+" ",
+" . + + + + + + + + + + + + + + + + + + @ ",
+" # $ % & & & & & & & & & & & & * * * * + ",
+" @ = - ; > > , , , , , ' ' ' ' ) ' , ! + ",
+" ~ { ] ^ , / ( ( _ _ _ _ _ _ _ _ : : < [ $ + } | ",
+" | 1 2 3 4 5 6 7 8 8 8 8 / 8 7 7 8 8 8 8 / 9 0 2 a b ",
+" c d 2 e f g h i i i i j j k l m m m m m n / o 2 2 p ",
+" { q d r s t u u u u u u u u u u u u u u u u v u w 2 a x ",
+" y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ",
+" | ` .2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ..+.@.#.$.%.{ ",
+" } &.*.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.-.;.>.,.'.).!. ",
+" ~.{.].^.^.^.^.^.^.^.^.^././././././././././././.(._.:.<.[.}. ",
+" |.1.2.3.3.3.3.3.3.3.4.5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m. ",
+" n.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.p. ",
+" q.r.s.t.u.v.v.w._ x.f y.z.A.f B.C.v.5 D.E.F.G.H.I.J. ",
+" K.r.L.M.N.O.P.Q.R.S.5 T.U.V.W.X.X._ 6 Y.C.Z.`. +.+++ ",
+" @+#+$+%+( &+*+=+S.-+;+>+Q.,+'+Y.)+!+~+{+B.]+%+^+/+(+ ",
+" _+:+<+# [+}+A.|+1+-+2+3+{+4+5+6+7+8+9+N.7+v.0+a+b+c+ ",
+" d+e+f+g+4 h+i+4+j+k+l+m+n+o+p+q+r+[ ;+s+m+t+u+v+w+ ",
+" x+y+z+A+4+B+C+, D+, E+F+G+H+F+I+E+> ; J+'+K+L+M+N+ ",
+" O+P+Q+& R+S+T+U+z+V+[ W+X+Y+Z+`+ @- = .@+@@@#@$@%@ ",
+" &@*@=@-@;@>@,@'@)@!@~@{@]@^@4+]@/@(@_@:@<@3+[@}@|@ ",
+" 1@2@3@H+4@5@6@7@8@9@]@'@V+0@a@W+W+5@b@c@d@e@f@}@g@ ",
+" h@i@j@k@l@m@n@)@o@p@;@q@r@s@t@9@u@4@v@w@x@y@f@z@ ",
+" A@B@o@o@o@o@o@o@o@o@o@o@C@o@o@o@o@o@o@o@o@D@E@z@ ",
+" F.F@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@G@H@I@ ",
+" J@K@L@l@l@l@l@l@l@l@l@l@l@l@l@l@l@l@l@l@l@M@N@O@ ",
+" q@P@Q@R@S@a@T@U@V@W@X@Y@Z@`@Q@ #.#+#@###$#%#&#*# ",
+" =#W+x+-#-#;#;#>#1@1@1@1@,#,#'#'#'#'#P@P@)#!#~#(+ ",
+" {#]#^#/#/#(#(#X+V+v+v+v+V+V+_#_#_#:#:#<#<#[#m+}# ",
+" |#1#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#3# ",
+" "};
Added: trunk/gtk/src/icons/pkg-tiles-mode.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-tiles-mode.xpm…
==============================================================================
--- trunk/gtk/src/icons/pkg-tiles-mode.xpm (added)
+++ trunk/gtk/src/icons/pkg-tiles-mode.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,22 @@
+/* XPM */
+static const char * pkg_tiles_mode_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #000000",
+"+ c #707070",
+" ",
+" ...... ...... ",
+" .++++.+ .++++.+",
+" .+ .+ .+ .+",
+" .+ .+ .+ .+",
+" .+ .+ .+ .+",
+" ......+ ......+",
+" ++++++ ++++++",
+" ",
+" ...... ...... ",
+" .++++.+ .++++.+",
+" .+ .+ .+ .+",
+" .+ .+ .+ .+",
+" .+ .+ .+ .+",
+" ......+ ......+",
+" ++++++ ++++++"};
Added: trunk/gtk/src/icons/pkg-unlocked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/icons/pkg-unlocked.xpm?r…
==============================================================================
--- trunk/gtk/src/icons/pkg-unlocked.xpm (added)
+++ trunk/gtk/src/icons/pkg-unlocked.xpm Thu Dec 20 21:36:18 2007
@@ -0,0 +1,107 @@
+/* XPM */
+static const char * pkg_unlocked_xpm[] = {
+"16 16 88 1",
+" c None",
+". c #000000",
+"+ c #1E1E1E",
+"@ c #7A7A7A",
+"# c #D2D2D2",
+"$ c #DBDBDB",
+"% c #727272",
+"& c #080808",
+"* c #848484",
+"= c #BEBEBE",
+"- c #363636",
+"; c #1D1D1D",
+"> c #B1B1B1",
+", c #2D2D2D",
+"' c #C2C2C2",
+") c #090909",
+"! c #2E2E2E",
+"~ c #AAAAAA",
+"{ c #2B2B2B",
+"] c #C0C0C0",
+"^ c #161616",
+"/ c #C1C0C0",
+"( c #13110E",
+"_ c #9B9794",
+": c #201D1C",
+"< c #0B0B07",
+"[ c #040302",
+"} c #050403",
+"| c #0D0C09",
+"1 c #282624",
+"2 c #1A130B",
+"3 c #A59176",
+"4 c #E0C4A0",
+"5 c #DFC4A3",
+"6 c #DABE9A",
+"7 c #D6BA94",
+"8 c #CDA676",
+"9 c #815A2B",
+"0 c #E2C5A1",
+"a c #D8B58C",
+"b c #CA9F68",
+"c c #AC8758",
+"d c #A78252",
+"e c #A78253",
+"f c #A37B4B",
+"g c #BC8849",
+"h c #AC712E",
+"i c #E3C6A2",
+"j c #D5AE7E",
+"k c #B08D5F",
+"l c #D5B284",
+"m c #CFAB7C",
+"n c #CFAC7B",
+"o c #CBA471",
+"p c #BC8746",
+"q c #AA6F2B",
+"r c #E1C4A0",
+"s c #D0A674",
+"t c #C79B64",
+"u c #AA8455",
+"v c #A47E4E",
+"w c #A07744",
+"x c #BA8442",
+"y c #E1C29C",
+"z c #CEA470",
+"A c #AD8D64",
+"B c #D2B289",
+"C c #CDAC83",
+"D c #CEAD83",
+"E c #CCA77B",
+"F c #B8803E",
+"G c #AD7332",
+"H c #E0C29E",
+"I c #D4AC79",
+"J c #CDA66E",
+"K c #AF8D5E",
+"L c #AB8758",
+"M c #AB8858",
+"N c #A8814C",
+"O c #B47E3E",
+"P c #D0A874",
+"Q c #C6965D",
+"R c #BE8D50",
+"S c #BA894B",
+"T c #BD8C4E",
+"U c #BC8A4C",
+"V c #BA8647",
+"W c #A47136",
+" ",
+" .. ",
+" +@#$%& ",
+" *=-;>* ",
+",') !~. ",
+"{]. ^/. ",
+" (_:<[[}|12 ",
+" .3455666789.",
+" .0abcddefgh.",
+" .ijklmmnopq.",
+" .rstuvvvwxh.",
+" .yzABCCDEFG.",
+" .HIJKLLMNpO.",
+" .PQRRSSTUVW.",
+" .......... ",
+" "};
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
20 Dec '07
Author: rpmcruz
Date: Thu Dec 20 21:35:44 2007
New Revision: 43210
URL: http://svn.opensuse.org/viewcvs/yast?rev=43210&view=rev
Log:
Moving unstable-libyui to main.
Modified:
trunk/gtk/README
trunk/gtk/configure.in.in
Modified: trunk/gtk/README
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/README?rev=43210&r1=43209&r2…
==============================================================================
--- trunk/gtk/README (original)
+++ trunk/gtk/README Thu Dec 20 21:35:44 2007
@@ -34,8 +34,8 @@
/usr/lib/YaST2/bin/y2base /usr/share/doc/packages/yast2-core/libyui/examples/HelloWorld.ycp gtk
- In order to fire up YaST modules, run the ycc.sh script.
- (You'll need the zenity package installed.)
+ From OpenSuse 10.3 on, it should be picked up automatically if you use Gnome.
+ For other desktops, you can set yast-gtk to be used by editing /etc/sysconfig/yast2 .
In case of oddness append --nothreads to the cmdline,
Also check the log file: ~/.y2log
@@ -45,3 +45,4 @@
A code overview is given on the HACKING file.
For documentation of YaST in general:
http://developer.novell.com/wiki/index.php/Special:Downloads/yast/doc
+
Modified: trunk/gtk/configure.in.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/configure.in.in?rev=43210&r1…
==============================================================================
--- trunk/gtk/configure.in.in (original)
+++ trunk/gtk/configure.in.in Thu Dec 20 21:35:44 2007
@@ -27,19 +27,9 @@
fi
AC_SUBST(PKG_CONFIG)
-
AC_FUNC_ALLOCA
AC_HEADER_STDC
-dnl Try to find the Zypp includes
-AC_MSG_CHECKING([for zypp 3])
-if test -f /usr/include/zypp/SourceManager.h; then
- AC_DEFINE(PRE_ZYPP_3, 1, [defined if using an older SL10.1 era zypp])
- AC_MSG_RESULT([pre 3])
-else
- AC_MSG_RESULT([found])
-fi
-
PKG_CHECK_MODULES( ZYPP, libzypp )
AC_SUBST(ZYPP_LIBS)
@@ -62,19 +52,22 @@
yast_vers=`echo "$verstxt" | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
AC_DEFINE_UNQUOTED(YAST2_VERSION, $yast_vers, [yast version for compile conditionals])
-dnl new UI library
-AC_MSG_CHECKING([for old libyui])
PYUI_LIBS='-lpy2UI'
-if test $yast_vers -le 2015006; then
- PYUI_LIBS='-lyui'
- AC_MSG_RESULT([found])
-else
- AC_MSG_RESULT([use new lib])
-fi
AC_SUBST(PYUI_LIBS)
+dnl Checking for new libyui API...
+if ! test -f /usr/include/YaST2/yui/YApplication.h; then
+ AC_MSG_ERROR([
+*** Version of libyui >= 2.15.12 needed (your version: $verstxt)
+*** You can find it on: svn checkout http://svn.opensuse.org/svn/yast/trunk/core/
+*** Do "make -f Makefile.cvs" on root
+*** Then you just need to compile stuff under libyui,
+*** "cd libyui && make && sudo make install"
+*** libyui broke compatibility in order to get away from YCP structures,
+*** to make it easier for binding.])
+fi
+
AC_OUTPUT([Makefile src/Makefile])
-echo "
-Hello hacker: please read the README carefully while this builds.
-"
+echo "Hello hacker: checkout README while this builds."
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0