Author: rpmcruz
Date: Fri Feb 15 16:50:58 2008
New Revision: 44542
URL: http://svn.opensuse.org/viewcvs/yast?rev=44542&view=rev
Log:
src/YGUI.h/.cc, YGCCGtk.cc & YGComboBox.cc: libyui sync.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/Y2CCGtk.cc
trunk/gtk/src/YGComboBox.cc
trunk/gtk/src/YGMultiLineEdit.cc
trunk/gtk/src/YGUI.cc
trunk/gtk/src/YGUI.h
trunk/gtk/src/dummy.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=44542&r1=44541&r2=44542&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Fri Feb 15 16:50:58 2008
@@ -1,3 +1,7 @@
+2008-02-15 Ricardo Cruz
+
+ * src/YGUI.h/.cc, YGCCGtk.cc & YGComboBox.cc: libyui sync.
+
2008-02-05 Ricardo Cruz
* src/YGUI.h/.cc: libyui sync: moved glyph() from YUI to YApplication.
Modified: trunk/gtk/src/Y2CCGtk.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/Y2CCGtk.cc?rev=44542&r1=44541&r2=44542&view=diff
==============================================================================
--- trunk/gtk/src/Y2CCGtk.cc (original)
+++ trunk/gtk/src/Y2CCGtk.cc Fri Feb 15 16:50:58 2008
@@ -4,9 +4,9 @@
#include
#include
-#include
#include
-#include
+#include
+#include
class YGUIComponent : public YUIComponent
{
@@ -16,13 +16,12 @@
virtual string name() const { return "gtk"; }
- virtual YUI *createUI (int argc, char **argv,
- bool with_threads, const char * macro_file)
+ virtual YUI *createUI (bool with_threads)
{
#ifdef IMPL_DEBUG
- fprintf (stderr, "Create a gtk+ UI: %d '%s' !\n", with_threads, macro_file);
+ fprintf (stderr, "Create a gtk+ UI (with threads: %d) !\n", with_threads);
#endif
- return new YGUI (argc, argv, with_threads, macro_file);
+ return new YGUI (with_threads);
}
};
@@ -33,7 +32,7 @@
bool isServerCreator () const { return true; };
- Y2Component *create (const char * name) const
+ Y2Component *create (const char *name) const
{
y2milestone( "Creating %s component", name );
if (!strcmp (name, "gtk") ) {
Modified: trunk/gtk/src/YGComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=44542&r1=44541&r2=44542&view=diff
==============================================================================
--- trunk/gtk/src/YGComboBox.cc (original)
+++ trunk/gtk/src/YGComboBox.cc Fri Feb 15 16:50:58 2008
@@ -95,9 +95,10 @@
}
// YComboBox
- virtual void setInputMaxLength (const YCPInteger &numberOfChars)
+ virtual void setInputMaxLength (int length)
{
- gtk_entry_set_width_chars (getEntry(), numberOfChars->asInteger()->value());
+ gtk_entry_set_width_chars (getEntry(), length);
+ YComboBox::setInputMaxLength (length);
}
virtual void setValidChars (const string &validChars)
Modified: trunk/gtk/src/YGMultiLineEdit.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGMultiLineEdit.cc?rev=44542&r1=44541&r2=44542&view=diff
==============================================================================
--- trunk/gtk/src/YGMultiLineEdit.cc (original)
+++ trunk/gtk/src/YGMultiLineEdit.cc Fri Feb 15 16:50:58 2008
@@ -206,7 +206,8 @@
{
IMPL
string text (_text);
- YGUtils::replace (text, "&product;", 9, YUI::ui()->productName().c_str());
+ std::string productName = YUI::app()->productName();
+ YGUtils::replace (text, "&product;", 9, productName.c_str());
ygtk_html_wrap_set_text (getWidget(), text.c_str());
if (autoScrollDown())
Modified: trunk/gtk/src/YGUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=44542&r1=44541&r2=44542&view=diff
==============================================================================
--- trunk/gtk/src/YGUI.cc (original)
+++ trunk/gtk/src/YGUI.cc Fri Feb 15 16:50:58 2008
@@ -4,15 +4,16 @@
#include
#include
+#include
+#include
#include
#include
-#include
+#include
+#include
#include "YGUI.h"
#include "YGUtils.h"
#include "YGDialog.h"
#include
-#include
-#include
static std::string askForFileOrDirectory (GtkFileChooserAction action,
const std::string &path, const std::string &filter, const std::string &title);
@@ -20,28 +21,31 @@
#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 (bool with_threads)
+ : YUI (with_threads), m_done_init (false), busy_timeout (0)
{
IMPL
m_have_wm = true;
m_no_border = m_fullscreen = false;
m_default_size.width = m_default_size.height = 0;
- m_argc = argc;
- m_argv = g_new0 (char *, argc);
- memcpy (m_argv, argv, sizeof (char *) * argc);
- if (!with_threads)
- checkInit();
-
-#ifdef IMPL_DEBUG
- fprintf (stderr, "I'm initialized '%s' - come & get me !\n",
- with_threads ? "with threads !" : "no threads");
-#endif
+ // without this none of the (default) threading action works ...
+ topmostConstructorHasFinished();
+}
- for (int i = 1; i < m_argc; i++)
- {
- const char *argp = m_argv[i];
+void YGUI::checkInit()
+{
+ if (m_done_init)
+ return;
+ m_done_init = TRUE;
+
+ // retrieve command line args from /proc/<pid>/cmdline
+ YCommandLine cmdLine;
+ int argc = cmdLine.argc();
+ char **argv = cmdLine.argv();
+
+ for (int i = 1; i < argc; i++) {
+ const char *argp = argv[i];
if (!argp) continue;
if (argp[0] != '-') {
printf ("Warning: Unknown argument '%s'\n", argp);
@@ -84,25 +88,7 @@
printf ("Warning: Unknown argument '--%s'\n", argp);
}
- if (macro_file)
- playMacro (macro_file);
-
- // without this none of the (default) threading action works ...
- topmostConstructorHasFinished();
-}
-
-YGUI::~YGUI()
-{
- IMPL
- g_free (m_argv);
-}
-
-void YGUI::checkInit()
-{
- if (!m_done_init) {
- gtk_init (&m_argc, &m_argv);
- m_done_init = TRUE;
- }
+ gtk_init (&argc, &argv);
}
static inline GdkScreen *getScreen ()
@@ -176,6 +162,8 @@
YEvent *YGUI::waitInput (unsigned long timeout_ms, bool block)
{
IMPL
+ checkInit();
+
#ifdef PRINT_EVENTS
fprintf (stderr, "%s()\n", block ? "userInput" : "pollInput");
#endif
@@ -345,9 +333,7 @@
}
// calculate a default filename...
- const char *baseName = moduleName();
- if (!baseName)
- baseName = "scr";
+ const char *baseName = "yast2-";
int nb;
map ::iterator it = screenShotNb.find (baseName);
@@ -383,15 +369,6 @@
goto makeScreenShot_ret;
}
- if (recordingMacro()) {
- // save the taking of the screenshot and its name to the macro
- macroRecorder->beginBlock();
- YDialog::currentDialog()->saveUserInput (macroRecorder);
- macroRecorder->recordMakeScreenShot (true, filename.c_str());
- macroRecorder->recordUserInput (YCPVoid());
- macroRecorder->endBlock();
- }
-
makeScreenShot_ret:
g_object_unref (G_OBJECT (shot));
}
@@ -406,8 +383,8 @@
void YGUI::toggleRecordMacro()
{
- if (recordingMacro()) {
- stopRecordMacro();
+ if (YMacro::recording()) {
+ YMacro::endRecording();
normalCursor();
GtkWidget* dialog = gtk_message_dialog_new (NULL,
@@ -420,7 +397,7 @@
string filename = askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SAVE,
DEFAULT_MACRO_FILE_NAME, "*.ycp", "Select Macro File to Record to");
if (!filename.empty())
- recordMacro (filename);
+ YMacro::record (filename);
}
}
@@ -430,7 +407,7 @@
DEFAULT_MACRO_FILE_NAME, "*.ycp", "Select Macro File to Play");
if (!filename.empty()) {
busyCursor();
- playMacro (filename);
+ YMacro::play (filename);
sendEvent (new YEvent()); // flush
}
}
Modified: trunk/gtk/src/YGUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=44542&r1=44541&r2=44542&view=diff
==============================================================================
--- trunk/gtk/src/YGUI.h (original)
+++ trunk/gtk/src/YGUI.h Fri Feb 15 16:50:58 2008
@@ -7,6 +7,7 @@
#include
#include
+#include <map>
#define ICON_DIR THEMEDIR "/icons/22x22/apps/"
@@ -40,9 +41,8 @@
class YGUI: public YUI
{
public:
- YGUI (int argc, char **argv,
- bool with_threads, const char *macro_file);
- virtual ~YGUI();
+ YGUI (bool with_threads);
+ void checkInit(); // called 1st time when execution thread kicks in
static YGUI *ui() { return (YGUI *) YUI::ui(); }
@@ -86,6 +86,7 @@
{ return m_event_handler.eventPendingFor (widget); }
private:
+ bool m_done_init;
guint busy_timeout; // for busy cursor
static gboolean busy_timeout_cb (gpointer data);
@@ -93,15 +94,9 @@
bool m_have_wm, m_no_border, m_fullscreen;
GtkRequisition m_default_size;
- // for delayed gtk+ init in the right thread
- bool m_done_init;
- int m_argc;
- char **m_argv;
- void checkInit();
-
// for screenshots:
- map screenShotNb;
- string screenShotNameTemplate;
+ std::map screenShotNb;
+ std::string screenShotNameTemplate;
public:
// Helpers for internal use [ visibility hidden ]
Modified: trunk/gtk/src/dummy.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/dummy.cc?rev=44542&r1=44541&r2=44542&view=diff
==============================================================================
--- trunk/gtk/src/dummy.cc (original)
+++ trunk/gtk/src/dummy.cc Fri Feb 15 16:50:58 2008
@@ -7,6 +7,7 @@
int main (int argc, char **argv)
{
- YGUI(argc, argv, false, "foo");
+ YGUI(false);
return 0;
}
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org