Mailinglist Archive: yast-commit (590 mails)

< Previous Next >
[yast-commit] r61553 - in /trunk/gtk: ChangeLog src/pkg/ygtkpkgdetailview.cc src/pkg/ygtkpkghistorydialog.cc
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Thu, 01 Apr 2010 03:40:23 -0000
  • Message-id: <E1NxBGa-0008Mg-06@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Thu Apr 1 05:40:23 2010
New Revision: 61553

URL: http://svn.opensuse.org/viewcvs/yast?rev=61553&view=rev
Log:
* src/pkg/ygtkpkghistorydialog.cc: set dialog non-modal.

* src/pkg/ygtkpkgdetailview.cc: added line to changelog
indicating it only applies to the installed version.

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/pkg/ygtkpkgdetailview.cc
trunk/gtk/src/pkg/ygtkpkghistorydialog.cc

Modified: trunk/gtk/ChangeLog
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=61553&r1=61552&r2=61553&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Thu Apr 1 05:40:23 2010
@@ -9,6 +9,11 @@
* src/pkg/YGPackageSelector.cc: aligned tool-box to
the right, and re-positioned it, as requested by Atri.

+ * src/pkg/ygtkpkghistorydialog.cc: set dialog non-modal.
+
+ * src/pkg/ygtkpkgdetailview.cc: added line to changelog
+ indicating it only applies to the installed version.
+
2010-03-31 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>

* src/ygtkpkghistorydialog.h/cc: fate#305859 and

Modified: trunk/gtk/src/pkg/ygtkpkgdetailview.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgdetailview.cc?rev=61553&r1=61552&r2=61553&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgdetailview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgdetailview.cc Thu Apr 1 05:40:23 2010
@@ -958,6 +958,8 @@
static std::string changelog (Ypp::Selectable &sel)
{
std::string text;
+ text.reserve (32768);
+ text = _("<p>Changelog applies only to the installed
version.</p>");
ZyppResObject zobj = sel.installed().zyppObj();
ZyppPackage zpkg = castZyppPackage (zobj);
if (zpkg) {

Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog.cc?rev=61553&r1=61552&r2=61553&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkghistorydialog.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkghistorydialog.cc Thu Apr 1 05:40:23 2010
@@ -127,10 +127,40 @@
GtkTextTag *bold_tag;
};

+static void write_file (const char *filename, const char *text)
+{
+ FILE *file = fopen (filename, "w");
+ fwrite (text, strlen (text), sizeof (char), file);
+ fclose (file);
+}
+
+static void response_cb (GtkDialog *dialog, gint response, GtkTextBuffer
*buffer)
+{
+ if (response == 1) {
+ GtkWidget *_dialog = gtk_file_chooser_dialog_new ("",
GTK_WINDOW (dialog),
+ GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_OPEN,
GTK_RESPONSE_OK,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 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_OK) {
+ gchar *filename = gtk_file_chooser_get_filename
(GTK_FILE_CHOOSER (_dialog));
+ GtkTextIter start, end;
+ gtk_text_buffer_get_bounds (buffer, &start, &end);
+ gchar *text = gtk_text_buffer_get_text (buffer, &start,
&end, FALSE);
+ write_file (filename, text);
+ g_free (text);
+ g_free (filename);
+ }
+ gtk_widget_destroy (_dialog);
+ }
+ else
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}

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);
@@ -165,11 +195,15 @@
gtk_container_add (GTK_CONTAINER (date_scroll), date_view);

GtkWidget *dialog = gtk_message_dialog_new (YGDialog::currentWindow(),
- GtkDialogFlags (0), GTK_MESSAGE_OTHER, GTK_BUTTONS_CLOSE,
_("History of Changes"));
+ GtkDialogFlags (0), GTK_MESSAGE_OTHER, GTK_BUTTONS_NONE,
_("History of Changes"));
+// gtk_dialog_add_button (GTK_DIALOG (dialog), _("Save to file"), 1);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE,
GTK_RESPONSE_DELETE_EVENT);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
FILENAME);
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);
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (response_cb), buffer);

GtkWidget *hpaned = gtk_hpaned_new();
gtk_paned_pack1 (GTK_PANED (hpaned), date_scroll, FALSE, FALSE);
@@ -177,7 +211,7 @@
gtk_paned_set_position (GTK_PANED (hpaned), 180);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hpaned);

- Handler handler (store, gtk_text_view_get_buffer (GTK_TEXT_VIEW
(text)));
+ Handler handler (store, buffer);
zypp::parser::HistoryLogReader parser (FILENAME, boost::ref (handler));
try {
parser.readAll();
@@ -192,8 +226,8 @@
}

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

void YGtkPkgHistoryDialog::popup()
-{ gtk_dialog_run (GTK_DIALOG (m_dialog)); }
+{ gtk_widget_show (m_dialog); }


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

< Previous Next >
This Thread
  • No further messages