Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions gtk/rgdebinstallprogress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,10 @@ void RGDebInstallProgress::cbClose(GtkWidget *self, void *data)
me->_updateFinished = true;
}

bool RGDebInstallProgress::close()
void RGDebInstallProgress::close()
{
if (child_has_exited)
cbClose(NULL, this);

return TRUE;
}

RGDebInstallProgress::~RGDebInstallProgress()
Expand Down
3 changes: 1 addition & 2 deletions gtk/rgdebinstallprogress.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
# include "rinstallprogress.h"

# include <apt-pkg/packagemanager.h>
# include <gdk/gdk.h>
# include <gtk/gtk.h>
# include <map>
# include <optional>
Expand Down Expand Up @@ -117,7 +116,7 @@ class RGDebInstallProgress : public RInstallProgress, public RGGtkBuilderWindow
GtkCssProvider *_cssProvider;

protected:
virtual bool close();
virtual void close() override;

virtual void prepare(RPackageLister *lister);

Expand Down
6 changes: 1 addition & 5 deletions gtk/rgfetchprogress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
#include <cassert>
#include <cmath>
#include <cstdio>
#include <glib.h>
#include <gobject/gclosure.h>
#include <gtk/gtk.h>
#include <string>
#include <unistd.h>
Expand All @@ -64,11 +62,9 @@ static const int COLUMN_PERCENT_WIDTH = 100;
static const int COLUMN_PERCENT_HEIGHT = 18;


bool RGFetchProgress::close()
void RGFetchProgress::close()
{
stopDownload(NULL, this);

return TRUE;
}

RGFetchProgress::RGFetchProgress(RGWindow *win)
Expand Down
4 changes: 1 addition & 3 deletions gtk/rgfetchprogress.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include "rggtkbuilderwindow.h"

#include <apt-pkg/acquire.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <set>
#include <string>
Expand Down Expand Up @@ -81,7 +79,7 @@ class RGFetchProgress : public pkgAcquireStatus, public RGGtkBuilderWindow
virtual void Fail(pkgAcquire::ItemDesc &Itm);
virtual void Start();
virtual void Stop();
virtual bool close();
virtual void close() override;

bool Pulse(pkgAcquire *Owner);

Expand Down
8 changes: 1 addition & 7 deletions gtk/rggtkbuilderwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ RGGtkBuilderWindow::RGGtkBuilderWindow(RGWindow *parent,

_win = GTK_WIDGET(gtk_builder_get_object(_builder, main_widget));
assert(_win);
init();

if (parent != NULL)
gtk_window_set_transient_for(GTK_WINDOW(_win),
Expand All @@ -76,13 +77,6 @@ RGGtkBuilderWindow::RGGtkBuilderWindow(RGWindow *parent,
gtk_window_set_icon_name(GTK_WINDOW(_win), "synaptic");

g_free(main_widget);

// gtk_window_set_title(GTK_WINDOW(_win), (char *)name.c_str());

g_object_set_data(G_OBJECT(_win), "me", this);
g_signal_connect(
G_OBJECT(_win), "delete-event", G_CALLBACK(windowCloseCallback), this);
_topBox = NULL;
}

bool RGGtkBuilderWindow::setLabel(const char *widget_name, const char *value)
Expand Down
4 changes: 1 addition & 3 deletions gtk/rggtkbuilderwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

#include "rgwindow.h"

#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <string>
#include <vector>
Expand Down Expand Up @@ -66,5 +64,5 @@ class RGGtkBuilderWindow : public RGWindow
GtkBuilder *getGtkBuilder()
{
return _builder;
};
}
};
5 changes: 1 addition & 4 deletions gtk/rginstallprogress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ void RGInstallProgressMsgs::onCloseClicked(GtkWidget *self, void *data)
gtk_main_quit();
}

bool RGInstallProgressMsgs::close()
void RGInstallProgressMsgs::close()
{
gtk_main_quit();
return true;
}

void RGInstallProgressMsgs::addText(const char *text, bool bold)
Expand Down Expand Up @@ -457,5 +456,3 @@ bool GeometryParser::Parse(string Geo)

return ret;
}

// vim:ts=3:sw=3:et
2 changes: 1 addition & 1 deletion gtk/rginstallprogress.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class RGInstallProgressMsgs : public RGGtkBuilderWindow

virtual bool empty();
virtual void run();
virtual bool close();
virtual void close() override;

RGInstallProgressMsgs(RGWindow *win);
~RGInstallProgressMsgs();
Expand Down
7 changes: 3 additions & 4 deletions gtk/rgmainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1578,10 +1578,10 @@ bool RGMainWindow::restoreState()
}


bool RGMainWindow::close()
void RGMainWindow::close()
{
if (_interfaceLocked > 0)
return true;
return;

RGGtkBuilderUserDialog dia(this);
if (_unsavedChanges == false || dia.run("quit")) {
Expand All @@ -1590,7 +1590,6 @@ bool RGMainWindow::close()
showErrors();
exit(0);
}
return true;
}


Expand Down Expand Up @@ -2675,7 +2674,7 @@ void RGMainWindow::cbProceedClicked(GSimpleAction *action,
RGFetchProgress *fprogress = me->_fetchProgress = new RGFetchProgress(me);
fprogress->setDescription(_("Downloading Package Files"), "");
// _("The package files will be cached locally for
//installation."));
// installation."));

// Do not let the treeview access the cache during the update.
me->setTreeLocked(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion gtk/rgmainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class RGMainWindow : public RGGtkBuilderWindow, public RPackageObserver
// display/table releated
void refreshSubViewList();

virtual bool close();
virtual void close() override;
static void closeWin(GSimpleAction *action, GVariant *parameter, gpointer me)
{
((RGMainWindow *)me)->close();
Expand Down
20 changes: 11 additions & 9 deletions gtk/rgpkgcdrom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

# include <gobject/gclosure.h>
# include <apt-pkg/cdrom.h>
# include <glib-object.h>
# include <glib.h>
# include <gtk/gtk.h>
# include <string>

Expand Down Expand Up @@ -89,26 +87,30 @@ bool RGCDScanner::AskCdromName(string &name)
}

RGCDScanner::RGCDScanner(RGMainWindow *main, RUserDialog *userDialog)
: pkgCdromStatus(), RGWindow(main, "cdscanner", true, false)
: pkgCdromStatus(), RGWindow(main, "cdscanner")
{
setTitle(_("Scanning CD-ROM"));

_userDialog = userDialog;

gtk_window_set_default_size(GTK_WINDOW(_win), 300, 120);

gtk_container_set_border_width(GTK_CONTAINER(_topBox), 10);
GtkWidget *topBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(_win), topBox);
gtk_widget_set_margin_top(topBox, 12);
gtk_widget_set_margin_bottom(topBox, 12);
gtk_widget_set_margin_start(topBox, 12);
gtk_widget_set_margin_end(topBox, 12);

_label = gtk_label_new("\n\n");
gtk_widget_show(_label);
gtk_box_pack_start(GTK_BOX(_topBox), _label, TRUE, TRUE, 10);
gtk_box_pack_start(GTK_BOX(topBox), _label, TRUE, TRUE, 10);

_pbar = gtk_progress_bar_new();
gtk_widget_show(_pbar);
gtk_widget_set_size_request(_pbar, -1, 25);
gtk_box_pack_start(GTK_BOX(_topBox), _pbar, FALSE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(topBox), _pbar, FALSE, TRUE, 0);

gtk_widget_show_all(topBox);

// gtk_window_set_skip_taskbar_hint(GTK_WINDOW(_win), TRUE);
gtk_window_set_transient_for(GTK_WINDOW(_win), GTK_WINDOW(main->window()));
gtk_window_set_position(GTK_WINDOW(_win), GTK_WIN_POS_CENTER_ON_PARENT);
}
Expand Down
3 changes: 1 addition & 2 deletions gtk/rgterminstallprogress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,9 @@ void RGTermInstallProgress::stopShell(GtkWidget *self, void *data)
me->hide();
}

bool RGTermInstallProgress::close()
void RGTermInstallProgress::close()
{
stopShell(NULL, this);
return true;
}


Expand Down
2 changes: 1 addition & 1 deletion gtk/rgterminstallprogress.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RGTermInstallProgress : public RInstallProgress, public RGGtkBuilderWindow
bool child_has_exited;
static void child_exited(VteTerminal *vteterminal, gint ret, gpointer data);
static void stopShell(GtkWidget *self, void *data);
virtual bool close();
virtual void close() override;

public:
RGTermInstallProgress(RGMainWindow *main);
Expand Down
70 changes: 11 additions & 59 deletions gtk/rgwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,95 +26,47 @@

#include "rgutils.h"

#include <cstddef>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
#include <glib-object.h>
#include <gobject/gclosure.h>
#include <gtk/gtk.h>
#include <string>

using namespace std;

bool RGWindow::windowCloseCallback(GtkWidget *window, GdkEvent *event)
gboolean RGWindow::windowCloseCallback(GtkWidget *window,
GdkEvent *event,
gpointer data)
{
// cout << "windowCloseCallback" << endl;
RGWindow *rwin = (RGWindow *)g_object_get_data(G_OBJECT(window), "me");

return rwin->close();
((RGWindow *)data)->close();
return TRUE;
}

RGWindow::RGWindow(string name, bool makeBox)
void RGWindow::init()
{
// std::cout << "RGWindow::RGWindow(string name, bool makeBox)" << endl;
_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(_win), (char *)name.c_str());
gtk_window_set_icon_name(GTK_WINDOW(_win), "synaptic");

g_object_set_data(G_OBJECT(_win), "me", this);

g_signal_connect(
G_OBJECT(_win), "delete-event", G_CALLBACK(windowCloseCallback), this);

if (makeBox) {
_topBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(_win), _topBox);
gtk_widget_show(_topBox);
gtk_container_set_border_width(GTK_CONTAINER(_topBox), 5);
} else {
_topBox = NULL;
}

// gtk_widget_realize(_win);
// gtk_widget_show_all(_win);
}


RGWindow::RGWindow(RGWindow *parent, string name, bool makeBox, bool closable)
RGWindow::RGWindow(RGWindow *parent, std::string name)
{
// std::cout
//<< "RGWindow::RGWindow(RGWindow *parent, string name, bool makeBox, bool
//closable)"
//<< endl;
_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(_win), (char *)name.c_str());

g_object_set_data(G_OBJECT(_win), "me", this);

g_signal_connect(
G_OBJECT(_win), "delete-event", G_CALLBACK(windowCloseCallback), this);

if (makeBox) {
_topBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(_win), _topBox);
gtk_widget_show(_topBox);
gtk_container_set_border_width(GTK_CONTAINER(_topBox), 5);
} else {
_topBox = NULL;
}

// gtk_widget_realize(_win);
init();

gtk_window_set_transient_for(GTK_WINDOW(_win), GTK_WINDOW(parent->window()));
}


RGWindow::~RGWindow()
{
// cout << "~RGWindow"<<endl;
gtk_widget_destroy(_win);
}


void RGWindow::setTitle(string title)
void RGWindow::setTitle(std::string title)
{
gtk_window_set_title(GTK_WINDOW(_win), (char *)title.c_str());
}

bool RGWindow::close()
void RGWindow::close()
{
// cout << "RGWindow::close()" << endl;
hide();
return true;
}

// vim:ts=3:sw=3:et
Loading