Mailinglist Archive: yast-commit (590 mails)

< Previous Next >
[yast-commit] r61646 - in /trunk/gtk: ./ src/ src/pkg/
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Sat, 10 Apr 2010 11:59:42 -0000
  • Message-id: <E1O0ZLi-0005wL-8q@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Sat Apr 10 13:59:41 2010
New Revision: 61646

URL: http://svn.opensuse.org/viewcvs/yast?rev=61646&view=rev
Log:
* src/pkg/ygtkpkghistorydialog.cc: re-worked the log
text as a list, making each item clickable
so user can easily see package details, and added
a few columns.

* src/pkg/ygtkpkghistorydialog.cc: added back
save-to-file button.

* src/ygtkcellrenderertextpixbuf.c: instead of stock
id and sizes use gtk-icon-theme stuff.

* src/pkg/ygtkpkgundolist.cc: added see-logs
button to the changes dialog.

* src/ygtktreeview.h/c: made it easier to plug a
context menu to show/hide columns.

* src/ygtktreeview.h/c: bug reporters requested
text be aligned right on Arabic, even if it is
English. So told gtk to blindly right-aligned text.

* src/ygtktreeview.c: show "loading"/"empty" text
when appropriate.

* src/YGTable.cc: use new ygtktreeview facility.

* src/ygtkcellrenderertextpixbuf.c: use the broader
icon theme facility instead of gtk stock one. (changed
some of the properties name.)

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGTable.cc
trunk/gtk/src/pkg/YGPackageSelector.cc
trunk/gtk/src/pkg/YGPackageSelector.h
trunk/gtk/src/pkg/ygtkpkgfilterview.cc
trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
trunk/gtk/src/pkg/ygtkpkglistview.cc
trunk/gtk/src/pkg/ygtkpkglistview.h
trunk/gtk/src/pkg/ygtkpkgmenubar.cc
trunk/gtk/src/pkg/ygtkpkgpatternview.cc
trunk/gtk/src/pkg/ygtkpkgstatusbar.cc
trunk/gtk/src/pkg/ygtkpkgundolist.cc
trunk/gtk/src/ygtkcellrenderertextpixbuf.c
trunk/gtk/src/ygtkcellrenderertextpixbuf.h
trunk/gtk/src/ygtktreeview.c
trunk/gtk/src/ygtktreeview.h

Modified: trunk/gtk/ChangeLog
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Sat Apr 10 13:59:41 2010
@@ -1,3 +1,35 @@
+2010-04-10 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>
+
+ * src/pkg/ygtkpkghistorydialog.cc: re-worked the log
+ text as a list, making each item clickable
+ so user can easily see package details, and added
+ a few columns.
+
+ * src/pkg/ygtkpkghistorydialog.cc: added back
+ save-to-file button.
+
+ * src/ygtkcellrenderertextpixbuf.c: instead of stock
+ id and sizes use gtk-icon-theme stuff.
+
+ * src/pkg/ygtkpkgundolist.cc: added see-logs
+ button to the changes dialog.
+
+ * src/ygtktreeview.h/c: made it easier to plug a
+ context menu to show/hide columns.
+
+ * src/ygtktreeview.h/c: bug reporters requested
+ text be aligned right on Arabic, even if it is
+ English. So told gtk to blindly right-aligned text.
+
+ * src/ygtktreeview.c: show "loading"/"empty" text
+ when appropriate.
+
+ * src/YGTable.cc: use new ygtktreeview facility.
+
+ * src/ygtkcellrenderertextpixbuf.c: use the broader
+ icon theme facility instead of gtk stock one. (changed
+ some of the properties name.)
+
2010-04-02 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>

* src/pkg/ygtkpkghistorydialog.cc: removed dead code.

Modified: trunk/gtk/src/YGTable.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/YGTable.cc (original)
+++ trunk/gtk/src/YGTable.cc Sat Apr 10 13:59:41 2010
@@ -56,12 +56,9 @@

void appendIconTextColumn (string header, YAlignmentType align, int
icon_col, int text_col)
{
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
-
- renderer = ygtk_cell_renderer_text_pixbuf_new();
- column = gtk_tree_view_column_new_with_attributes
(header.c_str(),
- renderer, "pixbuf", icon_col, "text", text_col, NULL);
+ GtkCellRenderer *renderer =
ygtk_cell_renderer_text_pixbuf_new();
+ GtkTreeViewColumn *column =
gtk_tree_view_column_new_with_attributes (
+ header.c_str(), renderer, "pixbuf", icon_col, "text",
text_col, NULL);

gfloat xalign = -1;
switch (align) {
@@ -83,30 +80,24 @@
}

gtk_tree_view_column_set_resizable (column, TRUE);
- gtk_tree_view_append_column (getView(), column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (getView()),
column);
}

void appendCheckColumn (string header, int bool_col)
{
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
-
- renderer = gtk_cell_renderer_toggle_new();
+ GtkCellRenderer *renderer = gtk_cell_renderer_toggle_new();
g_object_set_data (G_OBJECT (renderer), "column",
GINT_TO_POINTER (bool_col));
- column = gtk_tree_view_column_new_with_attributes
(header.c_str(),
- renderer, "active", bool_col, NULL);
-
+ GtkTreeViewColumn *column =
gtk_tree_view_column_new_with_attributes (
+ header.c_str(), renderer, "active", bool_col, NULL);
g_signal_connect (G_OBJECT (renderer), "toggled",
G_CALLBACK (toggled_cb), this);

gtk_tree_view_column_set_resizable (column, TRUE);
- gtk_tree_view_append_column (getView(), column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (getView()),
column);
}

- void appendDumbColumn()
- {
- gtk_tree_view_append_column (getView(),
gtk_tree_view_column_new());
- }
+ void appendEmptyColumn()
+ { gtk_tree_view_append_column (getView(), gtk_tree_view_column_new()); }

void setModel()
{ gtk_tree_view_set_model (GTK_TREE_VIEW (getWidget()), getModel()); }
@@ -266,7 +257,7 @@
appendIconTextColumn (header (i), align, col, col+1);
if ((align == YAlignCenter || align == YAlignEnd) && i
== columns()-1)
// if last col is aligned: add another so that
it doesn't expand.
- appendDumbColumn();
+ appendEmptyColumn();
}
setModel();
if (!keepSorting())
@@ -374,36 +365,38 @@
if (pThis->notifyContextMenu())
return YGTableView::right_click_cb (view, outreach,
pThis);
#endif
+ GtkWidget *menu = gtk_menu_new();
+
if (!YGDialog::currentDialog()->getFunctionWidget (5) ||
- // undetermined case -- more than one table exists
- YGDialog::currentDialog()->getClassWidgets
("YTable").size() > 1) {
+ YGDialog::currentDialog()->getClassWidgets
("YTable").size() > 1)
+ // more than one table exists, or no function key 5
assigned
gtk_widget_error_bell (GTK_WIDGET (view));
- return;
- }
-
- struct inner {
- static void key_activate_cb (GtkMenuItem *item, YWidget
*button)
- { activateButton (button); }
- static void appendItem (GtkWidget *menu, const gchar
*stock, int key)
- {
- YWidget *button =
YGDialog::currentDialog()->getFunctionWidget (key);
- if (button) {
- GtkWidget *item;
- item =
gtk_image_menu_item_new_from_stock (stock, NULL);
- gtk_menu_shell_append (GTK_MENU_SHELL
(menu), item);
- g_signal_connect (G_OBJECT (item),
"activate",
-
G_CALLBACK (key_activate_cb), button);
+ else {
+ struct inner {
+ static void key_activate_cb (GtkMenuItem *item,
YWidget *button)
+ { activateButton (button); }
+ static void appendItem (GtkWidget *menu, const
gchar *stock, int key)
+ {
+ YWidget *button =
YGDialog::currentDialog()->getFunctionWidget (key);
+ if (button) {
+ GtkWidget *item;
+ item =
gtk_image_menu_item_new_from_stock (stock, NULL);
+ gtk_menu_shell_append
(GTK_MENU_SHELL (menu), item);
+ g_signal_connect (G_OBJECT
(item), "activate",
+
G_CALLBACK (key_activate_cb), button);
+ }
}
- }
- };
+ };

- GtkWidget *menu = gtk_menu_new();
- if (outreach)
- inner::appendItem (menu, GTK_STOCK_ADD, 3);
- else {
- inner::appendItem (menu, GTK_STOCK_EDIT, 4);
- inner::appendItem (menu, GTK_STOCK_DELETE, 5);
+ if (outreach)
+ inner::appendItem (menu, GTK_STOCK_ADD, 3);
+ else {
+ inner::appendItem (menu, GTK_STOCK_EDIT, 4);
+ inner::appendItem (menu, GTK_STOCK_DELETE, 5);
+ }
}
+
+ menu = ygtk_tree_view_append_show_columns_item (YGTK_TREE_VIEW
(view), menu);
ygtk_tree_view_popup_menu (view, menu);
}


Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Sat Apr 10 13:59:41 2010
@@ -765,6 +765,9 @@
impl->refreshQuery();
}

+void YGPackageSelector::showRepoManager()
+{ YGUI::ui()->sendEvent (new YMenuEvent ("repo_mgr")); }
+
YGtkPkgUndoList *YGPackageSelector::undoList()
{ return impl->m_undo; }


Modified: trunk/gtk/src/pkg/YGPackageSelector.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.h?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.h (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.h Sat Apr 10 13:59:41 2010
@@ -32,6 +32,7 @@
void showSelectableDetails (Ypp::Selectable &sel);
void popupChanges();
void filterPkgSuffix (const std::string &suffix, bool enable);
+ void showRepoManager();

YGtkPkgUndoList *undoList();
YGtkPkgSearchEntry *getSearchEntry();

Modified: trunk/gtk/src/pkg/ygtkpkgfilterview.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgfilterview.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgfilterview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgfilterview.cc Sat Apr 10 13:59:41 2010
@@ -157,10 +157,11 @@
}

YGtkPkgStatusModel *parent;
- Ypp::List list;

static int modifiedRow()
{ return YGPackageSelector::get()->onlineUpdateMode() ? 2 : 5; }
+
+ Ypp::List list;
};

static Ypp::StatusMatch::Status rowToStatus (int row)
@@ -208,8 +209,8 @@

void YGtkPkgStatusModel::updateRow (Ypp::List list, int row, gpointer data)
{
- bool hide_if_zero = row > 0;
impl->list = list;
+ bool hide_if_zero = row > 0;
Ypp::StatusMatch match (rowToStatus (row));
setRowCount (row, list.count (&match), hide_if_zero);
}
@@ -454,9 +455,8 @@
return NULL;
}

-#include <YEvent.h>
static void edit_clicked_cb (GtkWidget *button, YGtkPkgRepositoryModel *pThis)
-{ YGUI::ui()->sendEvent (new YMenuEvent ("repo_mgr")); }
+{ YGPackageSelector::get()->showRepoManager(); }

GtkWidget *YGtkPkgRepositoryModel::createInternalToolbox()
{
@@ -585,7 +585,7 @@
column = gtk_tree_view_column_new_with_attributes (NULL,
renderer, "pixbuf", YGtkPkgFilterModel::ICON_COLUMN,
"sensitive", YGtkPkgFilterModel::ENABLED_COLUMN, NULL);
- gtk_tree_view_append_column (view, column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (view), column);
}
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes (
@@ -593,7 +593,7 @@
"sensitive", YGtkPkgFilterModel::ENABLED_COLUMN, NULL);
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END,
NULL);
gtk_tree_view_column_set_expand (column, TRUE);
- gtk_tree_view_append_column (view, column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (view), column);

renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes (
@@ -601,7 +601,7 @@
"sensitive", YGtkPkgFilterModel::ENABLED_COLUMN, NULL);
g_object_set (G_OBJECT (renderer), "xalign", 1.0, "scale",
PANGO_SCALE_SMALL,
"foreground", "#8c8c8c", NULL);
- gtk_tree_view_append_column (view, column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (view), column);

GtkTreeSelection *selection = gtk_tree_view_get_selection (view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);

Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkghistorydialog.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkghistorydialog.cc Sat Apr 10 13:59:41 2010
@@ -7,158 +7,566 @@

#include "YGi18n.h"
#include "config.h"
-#include "YGDialog.h"
#include "ygtkpkghistorydialog.h"
+#include "YGDialog.h"
+#include "YGPackageSelector.h"
+#include "ygtkpkglistview.h"
+#include "ygtkcellrenderertextpixbuf.h"
#include <gtk/gtk.h>
-#include "ygtktextview.h"
+#include "ygtktreeview.h"

#include <zypp/parser/HistoryLogReader.h>
#define FILENAME "/var/log/zypp/history"

-static void selection_changed_cb (GtkTreeSelection *selection, GtkTextView
*text)
+static void getRepositoryInfo (const std::string &alias, std::string &name,
std::string &url)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
- if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
- char *date;
- gtk_tree_model_get (model, &iter, 0, &date, -1);
+ static std::map <std::string, zypp::RepoInfo> repos;
+ if (repos.empty()) {
+ zypp::RepoManager manager;
+ std::list <zypp::RepoInfo> known_repos =
manager.knownRepositories();
+ for (std::list <zypp::RepoInfo>::const_iterator it =
known_repos.begin();
+ it != known_repos.end(); it++)
+ repos[it->alias()] = *it;
+ }

- GtkTextBuffer *buffer = gtk_text_view_get_buffer (text);
- GtkTextMark *mark = gtk_text_buffer_get_mark (buffer, date);
- gtk_text_view_scroll_to_mark (text, mark, 0, TRUE, 0, 0);
- g_free (date);
+ std::map <std::string, zypp::RepoInfo>::iterator it = repos.find
(alias);
+ if (it != repos.end()) {
+ zypp::RepoInfo *repo = &it->second;
+ name = repo->name();
+ url = repo->url().asString();
}
+ else
+ name = alias; // return alias if repo not currently setup-ed
+}
+
+static std::string reqbyTreatment (const std::string &reqby)
+{
+ if (reqby.empty())
+ return _("automatic");
+ if (reqby.compare (0, 4, "root", 4) == 0)
+ return _("user: root");
+ return reqby;
}

struct Handler
{
- Handler (GtkListStore *store, GtkTextBuffer *buffer)
- : store (store), buffer (buffer)
+ virtual void date (const std::string &str, bool first) = 0;
+ virtual void item (const std::string &action, const std::string &name,
+ const std::string &description, const std::string
&repositoryName,
+ const std::string &repositoryUrl, const std::string &reqby,
bool autoReq) = 0;
+};
+
+struct LogListHandler
+{
+ GtkListStore *store;
+
+ enum Column { ICON_COLUMN, NAME_COLUMN, VERSION_URL_COLUMN,
REPOSITORY_COLUMN,
+ REQBY_COLUMN, REPOSITORY_ICON_COLUMN, REPOSITORY_URL_COLUMN,
SHORTCUT_COLUMN,
+ COLOR_COLUMN, XPAD_COLUMN, TOTAL_COLUMNS };
+
+ LogListHandler()
{
- bold_tag = gtk_text_buffer_create_tag (buffer, "bold",
- "weight", PANGO_WEIGHT_BOLD, "foreground", "#5c5c5c",
- "scale", PANGO_SCALE_LARGE, "pixels-below-lines", 6,
- "pixels-above-lines", 6, NULL);
+ store = gtk_list_store_new (TOTAL_COLUMNS, G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_INT);
}

- bool operator() (const zypp::HistoryItem::Ptr &item)
+ ~LogListHandler()
+ { g_object_unref (G_OBJECT (store)); }
+
+ GtkTreeModel *getModel()
+ { return GTK_TREE_MODEL (store); }
+
+ void addRow (GtkTreeIter *iter)
+ {
+ gtk_list_store_append (store, iter);
+ gtk_list_store_set (store, iter, ICON_COLUMN, NULL,
NAME_COLUMN, NULL,
+ VERSION_URL_COLUMN, NULL, REPOSITORY_COLUMN, NULL,
REQBY_COLUMN, NULL,
+ REPOSITORY_ICON_COLUMN, NULL, REPOSITORY_URL_COLUMN,
NULL,
+ SHORTCUT_COLUMN, NULL, COLOR_COLUMN, NULL, XPAD_COLUMN,
0, -1);
+ }
+
+ int date (const std::string &str, bool first)
+ {
+ GtkTreeIter iter;
+ if (!first) addRow (&iter); // white space
+ std::string _date = std::string ("<b>\u26ab ") + str + "</b>";
+ addRow (&iter);
+ gtk_list_store_set (store, &iter, NAME_COLUMN, _date.c_str(),
-1);
+
+ GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL
(store), &iter);
+ int row = gtk_tree_path_get_indices (path)[0];
+ gtk_tree_path_free (path);
+ return row;
+ }
+
+ void item (const std::string &action, const std::string &name,
+ const std::string &description, const std::string
&repositoryName,
+ const std::string &repositoryUrl, const std::string &reqby,
bool autoReq)
+ {
+ GtkTreeIter iter;
+ const char *icon = 0;
+ std::string shortcut = name;
+ if (action == _("install"))
+ icon = GTK_STOCK_ADD;
+ else if (action == _("upgrade"))
+ icon = GTK_STOCK_GO_UP;
+ else if (action == _("remove"))
+ icon = GTK_STOCK_REMOVE;
+ else {
+ icon = getRepositoryStockIcon (name);
+ shortcut = "_repo";
+ }
+
+ std::string _name;
+ _name.reserve (action.size() + name.size() + 10);
+ _name = std::string ("<b>") + action + "</b> " + name;
+ int xpad = 0; // autoReq ? 25 : 0;
+
+ const char *repo_icon = 0, *color = 0;
+ if (!repositoryUrl.empty()) {
+ repo_icon = getRepositoryStockIcon (repositoryUrl);
+ if (repositoryUrl.find ("update") != std::string::npos)
{
+ //color = "red";
+ _name += _(" <i>(patch)</i>");
+ }
+ }
+ if (autoReq)
+ _name += _(" <i>(auto)</i>");
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, ICON_COLUMN, icon,
NAME_COLUMN, _name.c_str(),
+ VERSION_URL_COLUMN, description.c_str(),
REPOSITORY_COLUMN, repositoryName.c_str(),
+ REPOSITORY_ICON_COLUMN, repo_icon,
REPOSITORY_URL_COLUMN, repositoryUrl.c_str(),
+ REQBY_COLUMN, reqby.c_str(), SHORTCUT_COLUMN,
shortcut.c_str(),
+ COLOR_COLUMN, color, XPAD_COLUMN, xpad, -1);
+ }
+};
+
+struct DateListHandler
+{
+ GtkListStore *store;
+
+ enum Column { TEXT_COLUMN, LOG_ROW_COLUMN, TOTAL_COLUMNS };
+
+ DateListHandler()
+ { store = gtk_list_store_new (TOTAL_COLUMNS, G_TYPE_STRING,
G_TYPE_INT); }
+
+ ~DateListHandler()
+ { g_object_unref (G_OBJECT (store)); }
+
+ GtkTreeModel *getModel()
+ { return GTK_TREE_MODEL (store); }
+
+ void date (const std::string &str, bool first, int log_row)
+ {
+ GtkTreeIter iter;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, TEXT_COLUMN, str.c_str(),
+ LOG_ROW_COLUMN, log_row, -1);
+ }
+};
+
+struct ListHandler : public Handler
+{
+ LogListHandler *log_handler;
+ DateListHandler *date_handler;
+
+ ListHandler()
{
- std::string _date (item->date.form ("%d %B %Y"));
- bool new_date = date != _date;
+ log_handler = new LogListHandler();
+ date_handler = new DateListHandler();
+ }
+
+ ~ListHandler()
+ { delete log_handler; delete date_handler; }
+
+ virtual void date (const std::string &str, bool first)
+ {
+ int row = log_handler->date (str, first);
+ date_handler->date (str, first, row);
+ }
+
+ virtual void item (const std::string &a, const std::string &n,
+ const std::string &d, const std::string &rn,
+ const std::string &ru, const std::string &rb, bool
ar)
+ { log_handler->item (a, n, d, rn, ru, rb, ar); }
+};
+
+struct FileHandler : public Handler
+{
+ FILE *file;
+
+ FileHandler (const char *filename)
+ { file = fopen (filename, "w"); }

- GtkTextIter text_iter;
- gtk_text_buffer_get_end_iter (buffer, &text_iter);
+ ~FileHandler()
+ { fclose (file); }

- if (new_date) {
- date = _date;
- GtkTreeIter list_iter;
- gtk_list_store_append (store, &list_iter);
- gtk_list_store_set (store, &list_iter,
- 0, date.c_str(), -1);
-
- gtk_text_buffer_create_mark (buffer, date.c_str(),
&text_iter, TRUE);
- gtk_text_buffer_insert_with_tags (buffer, &text_iter,
- (date + "\n").c_str(), -1, bold_tag, NULL);
- }
-
- std::string line;
- line.reserve (1024);
- line = "\t";
+ void addSpace()
+ { fwrite ("\n", sizeof (char), 1, file); }
+
+ virtual void date (const std::string &str, bool first)
+ {
+ if (!first)
+ addSpace();
+ fwrite (str.c_str(), sizeof (char), str.size(), file);
+ addSpace(); addSpace();
+ }
+
+ virtual void item (const std::string &action, const std::string &name,
+ const std::string &description, const std::string
&repositoryName,
+ const std::string &repositoryUrl, const std::string &reqby,
bool autoReq)
+ {
+ std::string str;
+ str.reserve (action.size() + name.size() + description.size() +
4);
+ str = std::string ("\t") + action + " " + name + " " +
description + "\n";
+ fwrite (str.c_str(), sizeof (char), str.size(), file);
+ }
+};
+
+struct ZyppHistoryParser
+{
+ Handler *handler;
+ std::string _date;
+ std::map <std::string, int> installed;
+
+ ZyppHistoryParser (Handler *handler)
+ : handler (handler)
+ {
+ zypp::parser::HistoryLogReader parser (FILENAME, boost::ref
(*this));
+ try {
+ parser.readAll();
+ }
+ catch (const zypp::Exception &ex) {
+ yuiWarning () << "Error: Could not load log file" <<
FILENAME << ": "
+ << ex.asUserHistory() << std::endl;
+ }
+ }
+
+ bool operator() (const zypp::HistoryItem::Ptr &item)
+ {
+ std::string date (item->date.form ("%d %B %Y"));
+ if (_date != date) {
+ handler->date (date, _date.empty());
+ _date = date;
+ }
+
+ std::string action, name, descrpt, repoName, repoUrl, reqby, t;
+ bool autoreq = false;
switch (item->action.toEnum()) {
case zypp::HistoryActionID::NONE_e:
break;
case zypp::HistoryActionID::INSTALL_e: {
zypp::HistoryItemInstall *_item =
static_cast <zypp::HistoryItemInstall
*> (item.get());
- line += _("install"); line += " ";
- line += _item->name + " ";
- line += _item->edition.version();
+ name = _item->name;
+ descrpt = _item->edition.version();
+ getRepositoryInfo (_item->repoalias, repoName,
repoUrl);
+ reqby = _item->reqby; autoreq = reqby.empty();
reqby = reqbyTreatment (reqby);
+ if (installed.find (name) != installed.end())
+ action = _("upgrade");
+ else {
+ action = _("install");
+ installed[name] = 0;
+ }
break;
}
case zypp::HistoryActionID::REMOVE_e: {
zypp::HistoryItemRemove *_item =
static_cast <zypp::HistoryItemRemove *>
(item.get());
- line += _("remove"); line += " ";
- line += _item->name + " ";
- line += _item->edition.version();
+ action = _("remove");
+ name = _item->name;
+ descrpt = _item->edition.version();
+ reqby = _item->reqby; autoreq = reqby.empty();
reqby = reqbyTreatment (reqby);
+ installed.erase (installed.find (name));
break;
}
case zypp::HistoryActionID::REPO_ADD_e: {
zypp::HistoryItemRepoAdd *_item =
static_cast <zypp::HistoryItemRepoAdd
*> (item.get());
- line += _("add repository"); line += " ";
- line += _item->alias;
+ action = _("add repository");
+ getRepositoryInfo (_item->alias, name, t);
+ descrpt = _item->url.asString();
break;
}
case zypp::HistoryActionID::REPO_REMOVE_e: {
zypp::HistoryItemRepoRemove *_item =
static_cast
<zypp::HistoryItemRepoRemove *> (item.get());
- line += _("remove repository"); line += " ";
- line += _item->alias;
+ action = _("remove repository");
+ name = _item->alias;
break;
}
case zypp::HistoryActionID::REPO_CHANGE_ALIAS_e: {
zypp::HistoryItemRepoAliasChange *_item =
static_cast
<zypp::HistoryItemRepoAliasChange *> (item.get());
- gchar *str = g_strdup_printf ("change
repository %s alias: %s",
- _item->oldalias.c_str(),
_item->newalias.c_str());
- line += str;
- g_free (str);
+ action = _("change repository alias");
+ name = _item->oldalias + " -> " +
_item->newalias;
break;
}
case zypp::HistoryActionID::REPO_CHANGE_URL_e: {
zypp::HistoryItemRepoUrlChange *_item =
static_cast
<zypp::HistoryItemRepoUrlChange *> (item.get());
- gchar *str = g_strdup_printf ("change
repository %s url: %s",
- _item->alias.c_str(),
_item->newurl.asString().c_str());
- line += str;
- g_free (str);
+ action = _("change repository url");
+ getRepositoryInfo (_item->alias, name, t);
+ descrpt = _item->newurl.asString();
break;
}
}
- line += "\n";
- gtk_text_buffer_insert (buffer, &text_iter, line.c_str(), -1);
+ if (!action.empty())
+ handler->item (action, name, descrpt, repoName,
repoUrl, reqby, autoreq);
return true;
}
-
- GtkListStore *store;
- GtkTextBuffer *buffer;
- std::string date;
- GtkTextTag *bold_tag;
};

-static void response_cb (GtkDialog *dialog, gint response, GtkTextBuffer
*buffer)
-{ gtk_widget_destroy (GTK_WIDGET (dialog)); }
+static void goto_clicked (GtkTreeView *log_view)
+{
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (log_view);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ char *shortcut;
+ gtk_tree_model_get (model, &iter,
LogListHandler::SHORTCUT_COLUMN, &shortcut, -1);
+ if (!strcmp (shortcut, "_repo"))
+ YGPackageSelector::get()->showRepoManager();
+ else
+ YGPackageSelector::get()->searchFor
(Ypp::PoolQuery::NAME, shortcut);
+ g_free (shortcut);
+ }
+
+ GtkWidget *dialog = gtk_widget_get_toplevel (GTK_WIDGET (log_view));
+ gtk_widget_destroy (dialog);
+}
+
+static void log_selection_changed_cb (GtkTreeSelection *selection, GtkDialog
*dialog)
+{
+ bool selected = gtk_tree_selection_count_selected_rows (selection) > 0;
+ gtk_dialog_set_response_sensitive (dialog, 1, selected);
+}
+
+static void log_row_activated_cb (GtkTreeView *view, GtkTreePath *path,
+ GtkTreeViewColumn *column)
+{ goto_clicked (view); }
+
+static gboolean log_can_select_cb (GtkTreeSelection *selection, GtkTreeModel
*model,
+ GtkTreePath *path, gboolean path_currently_selected, gpointer data)
+{
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gchar *shortcut;
+ gtk_tree_model_get (model, &iter, LogListHandler::SHORTCUT_COLUMN,
&shortcut, -1);
+ bool can_select = shortcut != NULL;
+ if (shortcut) g_free (shortcut);
+ return can_select;
+}
+
+static void date_selection_changed_cb (GtkTreeSelection *selection,
GtkTreeView *log_view)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ int log_row;
+ gtk_tree_model_get (model, &iter, 1, &log_row, -1);
+
+ GtkTreePath *path = gtk_tree_path_new_from_indices (log_row,
-1);
+ gtk_tree_view_scroll_to_cell (log_view, path, NULL, TRUE, 0, 0);
+ gtk_tree_path_free (path);
+ }
+}
+
+static void save_to_file (GtkWindow *parent)
+{
+ GtkWidget *dialog = gtk_file_chooser_dialog_new (_("Save logs to"),
parent,
+ GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
+ gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER
(dialog), TRUE);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
+ gchar *filename = gtk_file_chooser_get_filename
(GTK_FILE_CHOOSER (dialog));
+ FileHandler handler (filename);
+ ZyppHistoryParser parser (&handler);
+ g_free (filename);
+ }
+ gtk_widget_destroy (dialog);
+}
+
+static void response_cb (GtkDialog *dialog, gint response, GtkTreeView
*log_view)
+{
+ switch (response) {
+ case 1: goto_clicked (log_view); break;
+ case 2: save_to_file (GTK_WINDOW (dialog)); break;
+ default: gtk_widget_destroy (GTK_WIDGET (dialog)); break;
+ }
+}
+
+static gboolean query_tooltip_cb (GtkWidget *widget, gint x, gint y,
+ gboolean keyboard_mode, GtkTooltip *tooltip, YGtkPkgListView *pThis)
+{
+ GtkTreeView *view = GTK_TREE_VIEW (widget);
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ if (gtk_tree_view_get_tooltip_context (view,
+ &x, &y, keyboard_mode, &model, &path, &iter)) {
+ gtk_tree_view_set_tooltip_row (view, tooltip, path);
+ gtk_tree_path_free (path);
+
+ GtkTreeViewColumn *column;
+ int bx, by;
+ gtk_tree_view_convert_widget_to_bin_window_coords (
+ view, x, y, &bx, &by);
+ gtk_tree_view_get_path_at_pos (
+ view, x, y, NULL, &column, NULL, NULL);
+
+ std::string text;
+ text.reserve (254);
+ const char *icon = 0;
+
+ int col;
+ for (col = 0; gtk_tree_view_get_column (view, col); col++)
+ if (column == gtk_tree_view_get_column (view, col))
+ break;
+/*
+ char *color;
+ gtk_tree_model_get (model, &iter, LogListHandler::COLOR_COLUMN,
&color, -1);
+ bool has_color = color != NULL;
+ g_free (color);
+*/
+ switch (col) {
+ case LogListHandler::REPOSITORY_COLUMN: {
+ char *name, *url;
+ gtk_tree_model_get (model, &iter,
+ LogListHandler::REPOSITORY_COLUMN,
&name,
+ LogListHandler::REPOSITORY_URL_COLUMN,
&url, -1);
+ if (name && *name) {
+ text = name;
+ if (url && *url) {
+ text += "\n<small>"; text +=
url; text += "</small>";
+ icon = getRepositoryStockIcon
(url);
+ }
+ if (url)
+ g_free (url);
+ }
+ if (name)
+ g_free (name);
+ break;
+ }
+ case LogListHandler::NAME_COLUMN:
+ case LogListHandler::VERSION_URL_COLUMN:
+ case LogListHandler::REQBY_COLUMN: {
+ char *str;
+ gtk_tree_model_get (model, &iter, col, &str,
-1);
+ if (str && *str) {
+ text = str;
+/* if (has_color && col !=
LogListHandler::REQBY_COLUMN)
+ text += _(" (patch)");*/
+ }
+ if (str)
+ g_free (str);
+ break;
+ }
+ }
+
+ if (!text.empty()) {
+ gtk_tooltip_set_markup (tooltip, text.c_str());
+ gtk_tooltip_set_icon_from_icon_name (tooltip,
+ icon, GTK_ICON_SIZE_BUTTON);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static void right_click_cb (YGtkTreeView *view, gboolean outreach)
+{
+ GtkWidget *menu = ygtk_tree_view_append_show_columns_item (view, NULL);
+ ygtk_tree_view_popup_menu (view, menu);
+}

YGtkPkgHistoryDialog::YGtkPkgHistoryDialog()
{
- GtkWidget *text = ygtk_text_view_new (FALSE);
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
- GtkWidget *text_scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (text_scroll),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (text_scroll), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (text_scroll), text);
+ ListHandler handler;
+ ZyppHistoryParser parser (&handler);

- GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
- GtkWidget *date_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL
(store));
- g_object_unref (G_OBJECT (store));
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (date_view), 0);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (date_view), FALSE);
-
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes (
- NULL, renderer, "text", 0, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (date_view), column);
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
+ GtkWidget *log_view = ygtk_tree_view_new();
+ gtk_tree_view_set_model (GTK_TREE_VIEW (log_view),
handler.log_handler->getModel());
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (log_view),
LogListHandler::SHORTCUT_COLUMN);
+ gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (log_view), TRUE);
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (log_view), TRUE);
+ gtk_widget_set_has_tooltip (log_view, TRUE);
+ g_signal_connect (G_OBJECT (log_view), "query-tooltip",
+ G_CALLBACK (query_tooltip_cb), this);
+ g_signal_connect (G_OBJECT (log_view), "right-click",
+ G_CALLBACK (right_click_cb), this);
+
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+ "icon-name", LogListHandler::ICON_COLUMN, NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 38);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (log_view), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes (_("Action"),
renderer,
+ "markup", LogListHandler::NAME_COLUMN, "xpad",
LogListHandler::XPAD_COLUMN,
+ "foreground", LogListHandler::COLOR_COLUMN, NULL);
+ g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END,
NULL);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_expand (column, TRUE);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (log_view), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes (_("Version / URL"),
renderer,
+ "text", LogListHandler::VERSION_URL_COLUMN, "xpad",
LogListHandler::XPAD_COLUMN,
+ "foreground", LogListHandler::COLOR_COLUMN, NULL);
+ g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END,
NULL);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 100);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (log_view), column);

- //gtk_tree_view_column_set_sort_column_id (column, 1);
+ renderer = ygtk_cell_renderer_text_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes (_("Repository"),
renderer,
+ "text", LogListHandler::REPOSITORY_COLUMN,
+ "icon-name", LogListHandler::REPOSITORY_ICON_COLUMN, NULL);
+ g_object_set (G_OBJECT (renderer), "size", 16, NULL);
+ gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 140);
+ gtk_tree_view_column_set_visible (column, FALSE);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (log_view), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes (_("Requested by"),
renderer,
+ "text", LogListHandler::REQBY_COLUMN, NULL);
+ g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END,
NULL);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 100);
+ gtk_tree_view_column_set_visible (column, FALSE);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (log_view), column);
+
+ GtkWidget *log_scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (log_scroll),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (log_scroll), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (log_scroll), log_view);
+
+ GtkWidget *date_view = gtk_tree_view_new_with_model
(handler.date_handler->getModel());
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (date_view),
DateListHandler::TEXT_COLUMN);
gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (date_view), TRUE);

- GtkTreeSelection *selection = gtk_tree_view_get_selection
(GTK_TREE_VIEW (date_view));
- g_signal_connect (G_OBJECT (selection), "changed",
- G_CALLBACK (selection_changed_cb), text);
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes (_("Date"), renderer,
+ "text", DateListHandler::TEXT_COLUMN, NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (date_view), column);

GtkWidget *date_scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (date_scroll),
@@ -167,37 +575,42 @@
GTK_SCROLLED_WINDOW (date_scroll), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (date_scroll), date_view);

+ std::string title (_("History of Changes"));
+ title += " ("; title += FILENAME; title += ")";
GtkWidget *dialog = gtk_message_dialog_new (YGDialog::currentWindow(),
- GtkDialogFlags (0), GTK_MESSAGE_OTHER, GTK_BUTTONS_CLOSE,
_("History of Changes"));
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
FILENAME);
+ GtkDialogFlags (0), GTK_MESSAGE_OTHER, GTK_BUTTONS_NONE,
title.c_str());
+ gtk_dialog_add_button (GTK_DIALOG (dialog), _("Save to File"), 2);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_JUMP_TO, 1);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), 1, FALSE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
- gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 650, 600);
g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (response_cb), buffer);
+ G_CALLBACK (response_cb), log_view);

GtkWidget *hpaned = gtk_hpaned_new();
gtk_paned_pack1 (GTK_PANED (hpaned), date_scroll, FALSE, FALSE);
- gtk_paned_pack2 (GTK_PANED (hpaned), text_scroll, TRUE, FALSE);
+ gtk_paned_pack2 (GTK_PANED (hpaned), log_scroll, TRUE, FALSE);
gtk_paned_set_position (GTK_PANED (hpaned), 180);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hpaned);

- Handler handler (store, buffer);
- zypp::parser::HistoryLogReader parser (FILENAME, boost::ref (handler));
- try {
- parser.readAll();
- }
- catch (const zypp::Exception &ex) {
- yuiWarning () << "Error: Could not load log file" << FILENAME
<< ": "
- << ex.asUserHistory() << std::endl;
- }
-
gtk_widget_show_all (dialog);
m_dialog = dialog;
+
+ GtkTreeSelection *selection;
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (log_view));
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (log_selection_changed_cb), dialog);
+ g_signal_connect (G_OBJECT (log_view), "row-activated",
+ G_CALLBACK (log_row_activated_cb), NULL);
+ gtk_tree_selection_set_select_function (selection, log_can_select_cb,
NULL, NULL);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (date_view));
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (date_selection_changed_cb), log_view);
}

-YGtkPkgHistoryDialog::~YGtkPkgHistoryDialog()
-{} //gtk_widget_destroy (m_dialog); }
+YGtkPkgHistoryDialog::~YGtkPkgHistoryDialog() {}

void YGtkPkgHistoryDialog::popup()
{ gtk_widget_show (m_dialog); }

Modified: trunk/gtk/src/pkg/ygtkpkglistview.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkglistview.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkglistview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkglistview.cc Sat Apr 10 13:59:41 2010
@@ -398,14 +398,6 @@
{ pThis->getSelected().lock (false); }
static void select_all_cb (GtkMenuItem *item, YGtkPkgListView
*pThis)
{ pThis->selectAll(); }
- static void show_column_cb (GtkCheckMenuItem *item,
YGtkPkgListView *pThis)
- {
- int col = GPOINTER_TO_INT (g_object_get_data (G_OBJECT
(item), "column"));
- GtkTreeViewColumn *column = gtk_tree_view_get_column (
- GTK_TREE_VIEW (pThis->impl->view), col);
- bool visible = gtk_check_menu_item_get_active (item);
- gtk_tree_view_column_set_visible (column, visible);
- }
};

GtkWidget *menu = gtk_menu_new();
@@ -452,26 +444,7 @@
inner::appendItem (menu, NULL, NULL, GTK_STOCK_SELECT_ALL,
true, inner::select_all_cb, pThis);
gtk_menu_shell_append (GTK_MENU_SHELL (menu),
gtk_separator_menu_item_new());
- GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Show
column"));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- GtkWidget *submenu = gtk_menu_new();
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
- GList *columns = gtk_tree_view_get_columns (GTK_TREE_VIEW
(pThis->impl->view));
- int n = 0;
- for (GList *i = columns; i; i = i->next, n++) {
- GtkTreeViewColumn *column = (GtkTreeViewColumn *)
i->data;
- const gchar *header = gtk_tree_view_column_get_title
(column);
- if (header) {
- GtkWidget *item =
gtk_check_menu_item_new_with_label (header);
- g_object_set_data (G_OBJECT (item), "column",
GINT_TO_POINTER (n));
- gtk_menu_shell_append (GTK_MENU_SHELL
(submenu), item);
- gboolean visible =
gtk_tree_view_column_get_visible (column);
- gtk_check_menu_item_set_active
(GTK_CHECK_MENU_ITEM (item), visible);
- g_signal_connect (G_OBJECT (item), "toggled",
- G_CALLBACK (inner::show_column_cb),
pThis);
- }
- }
- g_list_free (columns);
+ ygtk_tree_view_append_show_columns_item (YGTK_TREE_VIEW
(pThis->impl->view), menu);
}
ygtk_tree_view_popup_menu (YGTK_TREE_VIEW (pThis->impl->view), menu);
}
@@ -745,7 +718,7 @@
}
else if (property == REPOSITORY_PROP)
gtk_tree_view_column_add_attribute (column, renderer,
- "stock-id", REPOSITORY_STOCK_PROP);
+ "icon-name", REPOSITORY_STOCK_PROP);

if (size != -1) // on several columns
gtk_tree_view_set_rules_hint (view, TRUE);
@@ -757,7 +730,7 @@
gtk_tree_view_column_set_expand (column, TRUE);
gtk_tree_view_column_set_visible (column, visible);
set_sort_column (this, column, property);
- gtk_tree_view_append_column (view, column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (view), column);
}

void YGtkPkgListView::addCheckColumn (int property)
@@ -970,29 +943,30 @@
return str;
}

+const char *getRepositoryStockIcon (const std::string &url)
+{
+ if (url.empty())
+ return GTK_STOCK_MISSING_IMAGE;
+ if (url.compare (0, 2, "cd", 2) == 0 || url.compare (0, 3, "dvd", 3) ==
0)
+ return GTK_STOCK_CDROM;
+ if (url.compare (0, 3, "iso", 3) == 0)
+ return GTK_STOCK_FILE;
+ if (url.find ("KDE") != std::string::npos)
+ return "pattern-kde";
+ if (url.find ("GNOME") != std::string::npos)
+ return "pattern-gnome";
+ if (url.find ("update") != std::string::npos)
+ return "yast-update";
+ if (url.find ("home") != std::string::npos)
+ return "yast-users";
+ return GTK_STOCK_NETWORK;
+}
+
const char *getRepositoryStockIcon (Ypp::Repository &repo)
{
- std::string url (repo.url());
- const char *icon;
if (repo.isSystem())
- icon = "yast-host";
- else if (url.empty())
- icon = GTK_STOCK_MISSING_IMAGE;
- else if (url.compare (0, 2, "cd", 2) == 0 || url.compare (0, 3, "dvd",
3) == 0)
- icon = GTK_STOCK_CDROM;
- else if (url.compare (0, 3, "iso", 3) == 0)
- icon = GTK_STOCK_FILE;
- else if (url.find ("KDE") != std::string::npos)
- icon = "pattern-kde";
- else if (url.find ("GNOME") != std::string::npos)
- icon = "pattern-gnome";
- else if (url.find ("update") != std::string::npos)
- icon = "yast-update";
- else if (url.find ("home") != std::string::npos)
- icon = "yast-users";
- else
- icon = GTK_STOCK_NETWORK;
- return icon;
+ return "yast-host";
+ return getRepositoryStockIcon (repo.url());
}

void highlightMarkup (std::string &text, const std::list <std::string>
&keywords,

Modified: trunk/gtk/src/pkg/ygtkpkglistview.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkglistview.h?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkglistview.h (original)
+++ trunk/gtk/src/pkg/ygtkpkglistview.h Sat Apr 10 13:59:41 2010
@@ -55,6 +55,7 @@

std::string getRepositoryLabel (Ypp::Repository &repo);
const char *getRepositoryStockIcon (Ypp::Repository &repo);
+const char *getRepositoryStockIcon (const std::string &url);

void highlightMarkup (std::string &text, const std::list <std::string>
&keywords,
const char *openTag, const char *closeTag, int
openTagLen, int closeTagLen);

Modified: trunk/gtk/src/pkg/ygtkpkgmenubar.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgmenubar.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgmenubar.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgmenubar.cc Sat Apr 10 13:59:41 2010
@@ -558,9 +558,9 @@
GtkWidget *menu_bar = m_menu, *item, *submenu;
item = append_menu_item (menu_bar, _("File"), NULL, NULL, NULL);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), (submenu =
gtk_menu_new()));
- append_menu_item (submenu, _("Import..."), GTK_STOCK_OPEN,
+ append_menu_item (submenu, _("Import..."), NULL,
G_CALLBACK (import_file_cb), this);
- append_menu_item (submenu, _("Export..."), GTK_STOCK_SAVE_AS,
+ append_menu_item (submenu, _("Export..."), NULL,
G_CALLBACK (export_file_cb), this);
append_menu_item (submenu, NULL, NULL, NULL, NULL);
append_menu_item (submenu, NULL, GTK_STOCK_APPLY, G_CALLBACK
(accept_item_cb), selector);
@@ -598,8 +598,9 @@
G_CALLBACK (show_products_cb), this);
append_menu_item (submenu, _("Show Package Changes"), NULL,
G_CALLBACK (show_pkg_changes_cb), this);
- append_menu_item (submenu, _("Show History of Changes"), NULL,
- G_CALLBACK (show_log_changes_cb), this);
+ if (!selector->onlineUpdateMode())
+ append_menu_item (submenu, _("Show History of
Changes"), NULL,
+ G_CALLBACK (show_log_changes_cb), this);
append_menu_item (submenu, NULL, NULL, NULL, NULL);
append_menu_item (submenu, _("Install All Matching -devel
Packages"), NULL,
G_CALLBACK (install_all_devel_pkgs_cb), this);

Modified: trunk/gtk/src/pkg/ygtkpkgpatternview.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgpatternview.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgpatternview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgpatternview.cc Sat Apr 10 13:59:41 2010
@@ -393,13 +393,13 @@
NULL, renderer, "active", CHECK_COLUMN, "visible",
HAS_CHECK_COLUMN, NULL);
g_signal_connect (G_OBJECT (renderer), "toggled",
G_CALLBACK (toggled_cb), this);
- gtk_tree_view_append_column (view, column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (view), column);

if (type == Ypp::Selectable::PATTERN) {
renderer = gtk_cell_renderer_pixbuf_new();
column = gtk_tree_view_column_new_with_attributes (NULL,
renderer, "pixbuf", ICON_COLUMN, "visible",
HAS_ICON_COLUMN, NULL);
- gtk_tree_view_append_column (view, column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (view), column);
}

renderer = gtk_cell_renderer_text_new();
@@ -407,7 +407,7 @@
NULL, renderer, "markup", TEXT_COLUMN, NULL);
g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END,
NULL);
gtk_tree_view_column_set_expand (column, TRUE);
- gtk_tree_view_append_column (view, column);
+ ygtk_tree_view_append_column (YGTK_TREE_VIEW (view), column);

GtkTreeSelection *selection = gtk_tree_view_get_selection (view);
gtk_tree_selection_set_select_function (selection, can_tree_select_cb,
NULL, NULL);

Modified: trunk/gtk/src/pkg/ygtkpkgstatusbar.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgstatusbar.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgstatusbar.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgstatusbar.cc Sat Apr 10 13:59:41 2010
@@ -99,12 +99,20 @@
}

gtk_label_set_markup (GTK_LABEL (text), str);
+ gtk_label_set_attributes (GTK_LABEL (text), NULL);
gtk_widget_set_sensitive (undo_button, TRUE);
g_free (str);
}
else {
gtk_image_clear (GTK_IMAGE (icon));
- gtk_label_set_markup (GTK_LABEL (text), _("<i>No
changes to perform</i>"));
+ gtk_label_set_text (GTK_LABEL (text), _("No changes to
perform"));
+
+ PangoAttrList *attrs = pango_attr_list_new();
+ pango_attr_list_insert (attrs,
pango_attr_foreground_new (120<<8, 120<<8, 120<<8));
+ pango_attr_list_insert (attrs, pango_attr_style_new
(PANGO_STYLE_ITALIC));
+ gtk_label_set_attributes (GTK_LABEL (text), attrs);
+ pango_attr_list_unref (attrs);
+
gtk_widget_set_sensitive (undo_button, FALSE);
}
set_ellipsize (text);

Modified: trunk/gtk/src/pkg/ygtkpkgundolist.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgundolist.cc?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgundolist.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgundolist.cc Sat Apr 10 13:59:41 2010
@@ -243,6 +243,8 @@
{ setList (undo->getList()); }
};

+#include "ygtkpkghistorydialog.h"
+
bool YGtkPkgUndoList::popupDialog (bool onApply)
{
GtkMessageType type = onApply ? GTK_MESSAGE_QUESTION :
GTK_MESSAGE_OTHER;
@@ -257,7 +259,8 @@
GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_UNDO,
GTK_ICON_SIZE_DIALOG);
gtk_widget_show (image);
gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog),
image);
- gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CLOSE,
GTK_RESPONSE_YES, NULL);
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog), _("See History"),
1,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_YES, NULL);

// work-around for GTK bug: when you set a custom icon, it is
packed as expanded
GtkWidget *hbox = gtk_widget_get_parent (image);
@@ -279,6 +282,10 @@
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);

int ret = gtk_dialog_run (GTK_DIALOG (dialog));
+ if (ret == 1) {
+ YGtkPkgHistoryDialog dialog;
+ dialog.popup();
+ }
gtk_widget_destroy (dialog);
return ret == GTK_RESPONSE_YES;
}

Modified: trunk/gtk/src/ygtkcellrenderertextpixbuf.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkcellrenderertextpixbuf.c?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/ygtkcellrenderertextpixbuf.c (original)
+++ trunk/gtk/src/ygtkcellrenderertextpixbuf.c Sat Apr 10 13:59:41 2010
@@ -7,6 +7,7 @@

#include <config.h>
#include "ygtkcellrenderertextpixbuf.h"
+#include <gtk/gtk.h>

extern GdkPixbuf *ygutils_setOpacity (const GdkPixbuf *src, int opacity,
gboolean alpha);

@@ -15,8 +16,8 @@
enum {
PROP_0,
PROP_PIXBUF,
- PROP_STOCK_ID,
- PROP_STOCK_SIZE,
+ PROP_ICON_NAME,
+ PROP_SIZE,
};

G_DEFINE_TYPE (YGtkCellRendererTextPixbuf, ygtk_cell_renderer_text_pixbuf,
GTK_TYPE_CELL_RENDERER_TEXT)
@@ -28,14 +29,14 @@
cell->xpad = cell->ypad = 0;
cell->xalign = 0;
cell->yalign = 0.5;
- tpcell->stock_size = GTK_ICON_SIZE_MENU;
+ tpcell->size = 22;
}

static void unset_image_properties (YGtkCellRendererTextPixbuf *cell)
{
- if (cell->stock_id) {
- g_free (cell->stock_id);
- cell->stock_id = NULL;
+ if (cell->icon_name) {
+ g_free (cell->icon_name);
+ cell->icon_name = NULL;
}
if (cell->pixbuf) {
g_object_unref (cell->pixbuf);
@@ -59,11 +60,11 @@
case PROP_PIXBUF:
g_value_set_object (value, G_OBJECT
(tpcell->pixbuf));
break;
- case PROP_STOCK_ID:
- g_value_set_string (value, tpcell->stock_id);
+ case PROP_ICON_NAME:
+ g_value_set_string (value, tpcell->icon_name);
break;
- case PROP_STOCK_SIZE:
- g_value_set_uint (value, tpcell->stock_size);
+ case PROP_SIZE:
+ g_value_set_uint (value, tpcell->size);
break;
}
}
@@ -82,12 +83,12 @@
unset_image_properties (tpcell);
tpcell->pixbuf = (GdkPixbuf *)
g_value_dup_object (value);
break;
- case PROP_STOCK_ID:
+ case PROP_ICON_NAME:
unset_image_properties (tpcell);
- tpcell->stock_id = g_value_dup_string (value);
+ tpcell->icon_name = g_value_dup_string (value);
break;
- case PROP_STOCK_SIZE:
- tpcell->stock_size = g_value_get_uint (value);
+ case PROP_SIZE:
+ tpcell->size = g_value_get_uint (value);
break;
}
}
@@ -106,8 +107,11 @@

static void ensure_pixbuf (YGtkCellRendererTextPixbuf *cell, GtkWidget *widget)
{
- if (cell->stock_id && !cell->pixbuf)
- cell->pixbuf = gtk_widget_render_icon (widget, cell->stock_id,
cell->stock_size, NULL);
+ if (cell->icon_name && !cell->pixbuf) {
+ GtkIconTheme *theme = gtk_icon_theme_get_default();
+ cell->pixbuf = gtk_icon_theme_load_icon (theme,
cell->icon_name, cell->size,
+ GTK_ICON_LOOKUP_FORCE_SIZE, NULL);
+ }
}

static void ygtk_cell_renderer_text_pixbuf_get_size_full (GtkCellRenderer
*cell,
@@ -253,10 +257,10 @@

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, readwrite_flag));
- g_object_class_install_property (object_class, PROP_STOCK_ID,
- g_param_spec_string ("stock-id", "Stock ID", "Stock icon to
render", NULL, readwrite_flag));
- g_object_class_install_property (object_class, PROP_STOCK_SIZE,
- g_param_spec_uint ("stock-size", "Size", "GtkIconSize of the
rendered icon",
- 0, G_MAXUINT, GTK_ICON_SIZE_MENU, readwrite_flag));
+ g_object_class_install_property (object_class, PROP_ICON_NAME,
+ g_param_spec_string ("icon-name", "Icon name", "Icon to
render", NULL, readwrite_flag));
+ g_object_class_install_property (object_class, PROP_SIZE,
+ g_param_spec_uint ("size", "Size", "Size of the icon to render",
+ 0, G_MAXUINT, 22, readwrite_flag));
}


Modified: trunk/gtk/src/ygtkcellrenderertextpixbuf.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkcellrenderertextpixbuf.h?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/ygtkcellrenderertextpixbuf.h (original)
+++ trunk/gtk/src/ygtkcellrenderertextpixbuf.h Sat Apr 10 13:59:41 2010
@@ -33,8 +33,8 @@

// private:
GdkPixbuf *pixbuf;
- gchar *stock_id;
- GtkIconSize stock_size;
+ gchar *icon_name;
+ gint size;
} YGtkCellRendererTextPixbuf;

typedef struct _YGtkCellRendererTextPixbufClass

Modified: trunk/gtk/src/ygtktreeview.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.c?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/ygtktreeview.c (original)
+++ trunk/gtk/src/ygtktreeview.c Sat Apr 10 13:59:41 2010
@@ -8,6 +8,8 @@
#include <config.h>
#include "ygtktreeview.h"
#include <gtk/gtk.h>
+#define YGI18N_C
+#include "YGi18n.h"

static guint right_click_signal = 0;

@@ -70,25 +72,119 @@
return TRUE;
}

-// Ensure selected row remains visible on window size changes
-static void ygtk_tree_view_size_allocate (GtkWidget *widget, GtkAllocation
*alloc)
+static gboolean _ygtk_tree_view_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
- GTK_WIDGET_CLASS (ygtk_tree_view_parent_class)->size_allocate (widget,
alloc);
-#if 0 // this doesn't work so well on gtk 2.18.1
- GtkTreeView *view = GTK_TREE_VIEW (widget);
- GtkTreeSelection *selection = gtk_tree_view_get_selection (view);
- GList *paths;
- paths = gtk_tree_selection_get_selected_rows (selection, NULL);
+ GTK_WIDGET_CLASS (ygtk_tree_view_parent_class)->expose_event (widget,
event);
+
+ if (event->window == gtk_tree_view_get_bin_window (GTK_TREE_VIEW
(widget))) {
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW
(widget));
+ GtkTreeIter iter;
+ if (!model || !gtk_tree_model_get_iter_first (model, &iter)) {
// empty tree-view
+ const char *text = _("No entries.");
+ if (!model)
+ text = _("Loading...");
+ cairo_t *cr = gdk_cairo_create (event->window);
+ PangoLayout *layout;
+ layout = gtk_widget_create_pango_layout (widget, text);
+
+ PangoAttrList *attrs = pango_attr_list_new();
+ pango_attr_list_insert (attrs,
pango_attr_foreground_new (160<<8, 160<<8, 160<<8));
+ pango_layout_set_attributes (layout, attrs);
+ pango_attr_list_unref (attrs);
+
+ int width, height;
+ pango_layout_get_pixel_size (layout, &width, &height);
+ int x, y;
+ x = (widget->allocation.width - width) / 2;
+ y = (widget->allocation.height - height) / 2;
+ cairo_move_to (cr, x, y);
+
+ pango_cairo_show_layout (cr, layout);
+ g_object_unref (layout);
+ cairo_destroy (cr);
+ }
+ }
+ return FALSE;
+}
+
+static void show_column_cb (GtkCheckMenuItem *item, GtkTreeView *view)
+{
+ int col = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item),
"column"));
+ GtkTreeViewColumn *column = gtk_tree_view_get_column (view, col);
+ gboolean visible = gtk_check_menu_item_get_active (item);
+ gtk_tree_view_column_set_visible (column, visible);
+}
+
+GtkWidget *ygtk_tree_view_create_show_columns_menu (YGtkTreeView *view)
+{
+ GtkWidget *menu = gtk_menu_new();
+ GList *columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
+ int n;
+ GList *i;
+ for (n = 0, i = columns; i; i = i->next, n++) {
+ GtkTreeViewColumn *column = (GtkTreeViewColumn *) i->data;
+ const gchar *header = gtk_tree_view_column_get_title (column);
+ if (header) {
+ GtkWidget *item = gtk_check_menu_item_new_with_label
(header);
+ g_object_set_data (G_OBJECT (item), "column",
GINT_TO_POINTER (n));
+
+ gboolean visible = gtk_tree_view_column_get_visible
(column);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
(item), visible);
+ g_signal_connect (G_OBJECT (item), "toggled",
+ G_CALLBACK (show_column_cb), view);
+
+ // see ygtk_tree_view_append_column(): we re-order
arabic column insertion
+ if (gtk_widget_get_default_direction() ==
GTK_TEXT_DIR_RTL)
+ gtk_menu_shell_prepend (GTK_MENU_SHELL (menu),
item);
+ else
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
item);

- if (paths && !paths->next) /*only one row selected*/ {
- GtkTreePath *path = (GtkTreePath *) paths->data;
- gtk_tree_view_scroll_to_cell (view, path, NULL, FALSE, 0, 0);
+ // if the user were to remove all columns, the
right-click would no longer work
+ gtk_widget_set_sensitive (item, n != 0);
+ }
}
- g_list_foreach (paths, (GFunc) gtk_tree_path_free, 0);
- g_list_free (paths);
-#endif
+ g_list_free (columns);
+ return menu;
+}
+
+GtkWidget *ygtk_tree_view_append_show_columns_item (YGtkTreeView *view,
GtkWidget *menu)
+{
+ if (!menu)
+ menu = gtk_menu_new();
+
+ GList *children = gtk_container_get_children (GTK_CONTAINER (menu));
+ g_list_free (children);
+ if (children) // non-null if it has children (in which case, add
separator)
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu),
gtk_separator_menu_item_new());
+
+ GtkWidget *submenu = ygtk_tree_view_create_show_columns_menu (view);
+ GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Show column"));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
+ return menu;
}

+void ygtk_tree_view_append_column (YGtkTreeView *view, GtkTreeViewColumn
*column)
+{
+ int pos = -1;
+ if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL) {
+ gtk_widget_set_direction (GTK_WIDGET (view), GTK_TEXT_DIR_LTR);
+
+ GList *renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT
(column));
+ GtkCellRenderer *renderer = (GtkCellRenderer *) renderers->data;
+ if (GTK_IS_CELL_RENDERER_TEXT (renderer)) {
+ g_object_set (G_OBJECT (renderer), "alignment",
PANGO_ALIGN_RIGHT, NULL);
+
+ PangoEllipsizeMode ellipsize;
+ g_object_get (G_OBJECT (renderer), "ellipsize",
&ellipsize, NULL);
+ if (ellipsize == PANGO_ELLIPSIZE_END)
+ g_object_set (G_OBJECT (renderer), "ellipsize",
PANGO_ELLIPSIZE_START, NULL);
+ }
+ g_list_free (renderers);
+ pos = 0;
+ }
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (view), column, pos);
+}

GtkWidget *ygtk_tree_view_new (void)
{ return g_object_new (YGTK_TYPE_TREE_VIEW, NULL); }
@@ -98,7 +194,7 @@
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->button_press_event = ygtk_tree_view_button_press_event;
gtkwidget_class->popup_menu = _ygtk_tree_view_popup_menu;
- gtkwidget_class->size_allocate = ygtk_tree_view_size_allocate;
+ gtkwidget_class->expose_event = _ygtk_tree_view_expose_event;

right_click_signal = g_signal_new ("right-click",
G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST,

Modified: trunk/gtk/src/ygtktreeview.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.h?rev=61646&r1=61645&r2=61646&view=diff
==============================================================================
--- trunk/gtk/src/ygtktreeview.h (original)
+++ trunk/gtk/src/ygtktreeview.h Sat Apr 10 13:59:41 2010
@@ -41,6 +41,14 @@

void ygtk_tree_view_popup_menu (YGtkTreeView *view, GtkWidget *menu);

+GtkWidget *ygtk_tree_view_create_show_columns_menu (YGtkTreeView *view);
+GtkWidget *ygtk_tree_view_append_show_columns_item (YGtkTreeView *view,
GtkWidget *menu);
+
+// use this method of adding columns to overload gtk Arabic tree-view layout by
+// a more sane and simpler one.
+// (if you do, use it for all your column adding needs.)
+void ygtk_tree_view_append_column (YGtkTreeView *view, GtkTreeViewColumn
*column);
+
G_END_DECLS
#endif /*YGTK_TREE_VIEW_H*/


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

< Previous Next >
This Thread
  • No further messages