Author: rpmcruz
Date: Sun Dec 5 21:29:21 2010
New Revision: 62940
URL: http://svn.opensuse.org/viewcvs/yast?rev=62940&view=rev
Log:
* src/ygtkpkgvestigialdialog.h/cc: show unneeded
packages (not done yet), as requested by Atri.
* src/YGUI.cc: tell package kit to shut down if
running, as requested by Atri.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGText.cc
trunk/gtk/src/YGUI.cc
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGUtils.h
trunk/gtk/src/YGWidget.h
trunk/gtk/src/pkg/CMakeLists.txt
trunk/gtk/src/pkg/YGPackageSelector.cc
trunk/gtk/src/pkg/YGPackageSelector.h
trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
trunk/gtk/src/pkg/ygtkpkghistorydialog.h
trunk/gtk/src/pkg/ygtkpkgmenubar.cc
trunk/gtk/src/pkg/ygtkpkgundolist.cc
trunk/gtk/src/pkg/yzyppwrapper.cc
trunk/gtk/src/pkg/yzyppwrapper.h
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Sun Dec 5 21:29:21 2010
@@ -1,3 +1,11 @@
+2010-12-05 Ricardo Cruz
+
+ * src/ygtkpkgvestigialdialog.h/cc: show unneeded
+ packages (not done yet), as requested by Atri.
+
+ * src/YGUI.cc: tell package kit to shut down if
+ running, as requested by Atri.
+
2010-11-10 Ricardo Cruz
* src/pkg/ygtkpkgfilterview.cc: use bold for "all
Modified: trunk/gtk/src/YGText.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGText.cc?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/YGText.cc (original)
+++ trunk/gtk/src/YGText.cc Sun Dec 5 21:29:21 2010
@@ -140,17 +140,28 @@
class YGLogView : public YLogView, public YGTextView
{
+bool m_cancelAutoScroll;
+
public:
YGLogView (YWidget *parent, const string &label, int visibleLines, int maxLines)
: YLogView (NULL, label, visibleLines, maxLines)
- , YGTextView (this, parent, label, false)
- {}
+ , YGTextView (this, parent, label, false), m_cancelAutoScroll (false)
+ {
+ GtkAdjustment *adj = GTK_TEXT_VIEW (getWidget())->vadjustment;
+ g_signal_connect (G_OBJECT (adj), "value-changed",
+ G_CALLBACK (adj_value_changed_cb), this);
+ }
// YLogView
virtual void displayLogText (const string &text)
{
setText (text);
- scrollToBottom();
+ if (!m_cancelAutoScroll) {
+ GtkAdjustment *adj = GTK_TEXT_VIEW (getWidget())->vadjustment;
+ g_signal_handlers_block_by_func (adj, (gpointer) adj_value_changed_cb, this);
+ scrollToBottom();
+ g_signal_handlers_unblock_by_func (adj, (gpointer) adj_value_changed_cb, this);
+ }
}
// YGWidget
@@ -163,6 +174,12 @@
return 50;
}
+ static void adj_value_changed_cb (GtkAdjustment *vadj, YGLogView *pThis)
+ {
+ // user scrolling - disable auto-scroll if user wants to look up
+ pThis->m_cancelAutoScroll = (vadj->value < vadj->upper - vadj->page_size);
+ }
+
YGLABEL_WIDGET_IMPL (YLogView)
};
Modified: trunk/gtk/src/YGUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/YGUI.cc (original)
+++ trunk/gtk/src/YGUI.cc Sun Dec 5 21:29:21 2010
@@ -153,6 +153,26 @@
gtk_window_set_default_icon (pixbuf);
g_object_unref (G_OBJECT (pixbuf));
}
+
+ if (m_swsingle) {
+ struct inner {
+ static bool is_pkkit_running() {
+ return YGUtils::exec ("dbus-send --system --dest=org.freedesktop.DBus "
+ "--type=method_call --print-reply --reply-timeout=200 "
+ "/ org.freedesktop.DBus.NameHasOwner "
+ "string:org.freedesktop.PackageKit").find (
+ "boolean false") != std::string::npos;
+ }
+
+ static void close_pkkit() {
+ YGUtils::exec ("/bin/dbus-send --system --dest=org.freedesktop.PackageKit "
+ "--type=method_call /org/freedesktop/PackageKit org.freedesktop.PackageKit.SuggestDaemonQuit");
+ }
+ };
+
+ if (inner::is_pkkit_running())
+ inner::close_pkkit();
+ }
}
static gboolean ycp_wakeup_fn (GIOChannel *source, GIOCondition condition,
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Sun Dec 5 21:29:21 2010
@@ -860,3 +860,14 @@
return ret;
}
+std::string YGUtils::exec (const char *cmd)
+{
+ FILE *pipe = popen (cmd, "r");
+ if (!pipe)
+ return "";
+ char buffer [1024];
+ fgets (buffer, 1024, pipe);
+ pclose (pipe);
+ return buffer;
+}
+
Modified: trunk/gtk/src/YGUtils.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.h?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.h (original)
+++ trunk/gtk/src/YGUtils.h Sun Dec 5 21:29:21 2010
@@ -68,6 +68,9 @@
/* Shrink widget inner-border (thickness) */
void shrinkWidget (GtkWidget *widget);
+
+ /* Runs and returns stdout of given command. */
+ std::string exec (const char *cmd);
};
extern "C" {
Modified: trunk/gtk/src/YGWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.h?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/YGWidget.h (original)
+++ trunk/gtk/src/YGWidget.h Sun Dec 5 21:29:21 2010
@@ -50,7 +50,7 @@
{ DELAY_EVENT = 2, IGNORE_NOTIFY_EVENT = 4, IF_NOT_PENDING_EVENT = 8 };
void emitEvent (YEvent::EventReason reason, EventFlags flags = (EventFlags) 0);
- // signal registration; use "BlockEvents (this)" to temp block all signals
+ // signal registration; use "BlockEvents (this)" to temp-ly block all signals
friend struct BlockEvents;
void connect (gpointer object, const char *name,
GCallback callback, gpointer data, bool after = true);
Modified: trunk/gtk/src/pkg/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/CMakeLists.txt?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/CMakeLists.txt (original)
+++ trunk/gtk/src/pkg/CMakeLists.txt Sun Dec 5 21:29:21 2010
@@ -17,6 +17,7 @@
ygtkpkgsearchentry.cc
ygtkpkgstatusbar.cc
ygtkpkgundolist.cc
+ ygtkpkgvestigialdialog.cc
yzypptags.cc
yzyppwrapper.cc
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.cc (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.cc Sun Dec 5 21:29:21 2010
@@ -27,6 +27,9 @@
#include "ygtkpkgstatusbar.h"
#include "ygtkpkgdetailview.h"
+#include "ygtkpkghistorydialog.h"
+#include "ygtkpkgvestigialdialog.h"
+
//#define USE_LIST_BUTTONS
YGPackageSelector *YGPackageSelector::singleton = 0;
@@ -653,7 +656,8 @@
}
YGPackageSelector::YGPackageSelector (YWidget *parent, long mode)
-: YPackageSelector (NULL, mode), YGWidget (this, parent, YGTK_TYPE_WIZARD, NULL)
+: YPackageSelector (NULL, mode), YGWidget (this, parent, YGTK_TYPE_WIZARD, NULL),
+m_historyDialog (NULL), m_vestigialDialog (NULL)
{
singleton = this;
setBorder (0);
@@ -709,6 +713,7 @@
YGPackageSelector::~YGPackageSelector()
{
+ delete m_historyDialog; delete m_vestigialDialog;
delete impl;
singleton = 0;
}
@@ -756,10 +761,6 @@
impl->refreshQuery();
}
-void YGPackageSelector::showSelectableDetails (Ypp::Selectable &sel)
-{
-}
-
void YGPackageSelector::popupChanges()
{ impl->m_undo->popupDialog (false); }
@@ -775,6 +776,20 @@
void YGPackageSelector::showRepoManager()
{ YGUI::ui()->sendEvent (new YMenuEvent ("repo_mgr")); }
+void YGPackageSelector::showHistoryDialog()
+{
+ if (!m_historyDialog)
+ m_historyDialog = new YGtkPkgHistoryDialog();
+ m_historyDialog->popup();
+}
+
+void YGPackageSelector::showVestigialDialog()
+{
+ if (!m_vestigialDialog)
+ m_vestigialDialog = new YGtkPkgVestigialDialog();
+ m_vestigialDialog->popup();
+}
+
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=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/YGPackageSelector.h (original)
+++ trunk/gtk/src/pkg/YGPackageSelector.h Sun Dec 5 21:29:21 2010
@@ -15,6 +15,8 @@
struct YGtkPkgUndoList;
struct YGtkPkgSearchEntry;
+struct YGtkPkgHistoryDialog;
+struct YGtkPkgVestigialDialog;
class YGPackageSelector : public YPackageSelector, YGWidget
{
@@ -29,11 +31,13 @@
void showFilterWidget (const char *filter);
void searchFor (Ypp::PoolQuery::StringAttribute attrb, const std::string &text);
- void showSelectableDetails (Ypp::Selectable &sel);
void popupChanges();
void filterPkgSuffix (const std::string &suffix, bool enable_filter);
void showRepoManager();
+ void showHistoryDialog();
+ void showVestigialDialog();
+
YGtkPkgUndoList *undoList();
YGtkPkgSearchEntry *getSearchEntry();
@@ -46,8 +50,12 @@
struct Impl;
Impl *impl;
+
private:
static YGPackageSelector *singleton;
+
+ YGtkPkgHistoryDialog *m_historyDialog;
+ YGtkPkgVestigialDialog *m_vestigialDialog;
};
#endif
Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog.cc?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkghistorydialog.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkghistorydialog.cc Sun Dec 5 21:29:21 2010
@@ -22,27 +22,6 @@
#include
#define FILENAME "/var/log/zypp/history"
-static void getRepositoryInfo (const std::string &alias, std::string &name, std::string &url)
-{
- static std::map 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;
- }
-
- std::map ::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())
@@ -284,7 +263,7 @@
static_cast (item.get());
name = _item->name;
descrpt = _item->edition.version();
- getRepositoryInfo (_item->repoalias, repoName, repoUrl);
+ Ypp::getRepositoryFromAlias (_item->repoalias, repoName, repoUrl);
reqby = _item->reqby; autoreq = reqby.empty();
reqby = reqbyTreatment (reqby);
zypp::Edition edition = _item->edition;
@@ -322,7 +301,7 @@
zypp::HistoryItemRepoAdd *_item =
static_cast (item.get());
action = _("add repository");
- getRepositoryInfo (_item->alias, name, t);
+ Ypp::getRepositoryFromAlias (_item->alias, name, t);
descrpt = _item->url.asString();
break;
}
@@ -344,7 +323,7 @@
zypp::HistoryItemRepoUrlChange *_item =
static_cast (item.get());
action = _("change repository url");
- getRepositoryInfo (_item->alias, name, t);
+ Ypp::getRepositoryFromAlias (_item->alias, name, t);
descrpt = _item->newurl.asString();
break;
}
@@ -671,16 +650,9 @@
gdk_window_set_cursor (dialog->window, NULL);
}
-YGtkPkgHistoryDialog::~YGtkPkgHistoryDialog() {}
+YGtkPkgHistoryDialog::~YGtkPkgHistoryDialog()
+{ gtk_widget_destroy (m_dialog); }
void YGtkPkgHistoryDialog::popup()
{ gtk_window_present (GTK_WINDOW (m_dialog)); }
-void popupHistoryDialog()
-{
- static YGtkPkgHistoryDialog *dialog = 0;
- if (!dialog)
- dialog = new YGtkPkgHistoryDialog();
- dialog->popup();
-}
-
Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog.h?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkghistorydialog.h (original)
+++ trunk/gtk/src/pkg/ygtkpkghistorydialog.h Sun Dec 5 21:29:21 2010
@@ -22,8 +22,8 @@
GtkWidget *m_dialog;
};
-// use this method to create the dialog -- so it is cached
-void popupHistoryDialog();
+// you do not want to use this class directly:
+// use YGPackageSelector::get()->showHistoryDialog()
#endif
Modified: trunk/gtk/src/pkg/ygtkpkgmenubar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgmenubar.cc?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgmenubar.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgmenubar.cc Sun Dec 5 21:29:21 2010
@@ -655,11 +655,11 @@
static void show_pkg_changes_cb()
{ YGPackageSelector::get()->popupChanges(); }
-
-#include "ygtkpkghistorydialog.h"
-
static void show_log_changes_cb()
-{ popupHistoryDialog(); }
+{ YGPackageSelector::get()->showHistoryDialog(); }
+
+static void show_vestigial_packages_cb()
+{ YGPackageSelector::get()->showVestigialDialog(); }
static void reset_ignored_dependency_conflicts_cb()
{ zypp::getZYpp()->resolver()->undo(); }
@@ -730,9 +730,12 @@
G_CALLBACK (show_products_cb), this);
append_menu_item (submenu, _("Show _Changes"), NULL,
G_CALLBACK (show_pkg_changes_cb), this);
- if (!selector->onlineUpdateMode())
+ if (!selector->onlineUpdateMode()) {
append_menu_item (submenu, _("Show _History"), NULL,
G_CALLBACK (show_log_changes_cb), this);
+ append_menu_item (submenu, _("Show _Unneeded Dependencies"), NULL,
+ G_CALLBACK (show_vestigial_packages_cb), this);
+ }
append_menu_item (submenu, NULL, NULL, NULL, NULL);
// Translators: keep "-_devel" untranslated
append_menu_item (submenu, _("Install All Matching -_devel Packages"), NULL,
Modified: trunk/gtk/src/pkg/ygtkpkgundolist.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgundolist.cc?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgundolist.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgundolist.cc Sun Dec 5 21:29:21 2010
@@ -311,7 +311,7 @@
int ret = gtk_dialog_run (GTK_DIALOG (dialog));
if (ret == 1)
- popupHistoryDialog();
+ YGPackageSelector::get()->showHistoryDialog();
gtk_widget_destroy (dialog);
return ret == GTK_RESPONSE_YES;
}
Modified: trunk/gtk/src/pkg/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.cc?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/yzyppwrapper.cc (original)
+++ trunk/gtk/src/pkg/yzyppwrapper.cc Sun Dec 5 21:29:21 2010
@@ -45,6 +45,27 @@
bool Ypp::Repository::operator == (const Ypp::Repository &other) const
{ return this->m_repo.info().alias() == other.m_repo.info().alias(); }
+void Ypp::getRepositoryFromAlias (const std::string &alias, std::string &name, std::string &url)
+{
+ static std::map 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;
+ }
+
+ std::map ::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
+}
+
// Version
Ypp::Version::Version (ZyppResObject zobj)
Modified: trunk/gtk/src/pkg/yzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.h?rev=62940&r1=62939&r2=62940&view=diff
==============================================================================
--- trunk/gtk/src/pkg/yzyppwrapper.h (original)
+++ trunk/gtk/src/pkg/yzyppwrapper.h Sun Dec 5 21:29:21 2010
@@ -110,6 +110,9 @@
bool m_onlyInfo;
};
+ void getRepositoryFromAlias (const std::string &alias,
+ std::string &name, std::string &url);
+
// Selectable & complementory structs
struct Version {
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org