svnno****@sourc*****
svnno****@sourc*****
Wed Apr 4 10:08:45 JST 2007
Revision: 3131 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=kazehakase&view=rev&rev=3131 Author: ikezoe Date: 2007-04-04 10:08:45 +0900 (Wed, 04 Apr 2007) Log Message: ----------- * src/utils.[ch]: Implement kz_utils_get_system_name(). TODO: This function cannot be compiled on Windows. * module/embed/gecko/kz-gecko-single.cpp, module/embed/gtk-webcore/kz-gtk-webcore.cpp: Use kz_utils_get_system_name. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/module/embed/gecko/kz-gecko-single.cpp kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp kazehakase/trunk/src/utils/utils.c kazehakase/trunk/src/utils/utils.h Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2007-04-04 00:03:31 UTC (rev 3130) +++ kazehakase/trunk/ChangeLog 2007-04-04 01:08:45 UTC (rev 3131) @@ -9,6 +9,11 @@ kz_gtk_webcore_(get|set)_lock(). Though these functions should be implemented in KzEmbed, KzEmbed now has no private structure because it isn't an instance. I have no idea what it should be. + * src/utils.[ch]: Implement kz_utils_get_system_name(). + TODO: This function cannot be compiled on Windows. + * module/embed/gecko/kz-gecko-single.cpp, + module/embed/gtk-webcore/kz-gtk-webcore.cpp: Use + kz_utils_get_system_name. 2007-04-03 Hiroyuki Ikezoe <poinc****@ikezo*****> Modified: kazehakase/trunk/module/embed/gecko/kz-gecko-single.cpp =================================================================== --- kazehakase/trunk/module/embed/gecko/kz-gecko-single.cpp 2007-04-04 00:03:31 UTC (rev 3130) +++ kazehakase/trunk/module/embed/gecko/kz-gecko-single.cpp 2007-04-04 01:08:45 UTC (rev 3131) @@ -23,7 +23,6 @@ #endif /* HAVE_CONFIG_H */ #include <nsBuildID.h> -#include <sys/utsname.h> #include <glib/gi18n.h> #include "kz-gecko-single.h" #include "kz-app.h" @@ -303,20 +302,10 @@ static void build_user_agent (gchar *user_agent, gint size) { - struct utsname name; gchar *system; - if (uname (&name) >= 0) - { - system = g_strdup_printf ("%s %s", - name.sysname, - name.machine); - } - else - { - system = g_strdup ("Unknown"); - } - + system = kz_utils_get_system_name(); + g_snprintf(user_agent, size, "Mozilla/5.0 (X11; %s; U;) Gecko/%d Kazehakase/" VERSION, system, Modified: kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp =================================================================== --- kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp 2007-04-04 00:03:31 UTC (rev 3130) +++ kazehakase/trunk/module/embed/gtk-webcore/kz-gtk-webcore.cpp 2007-04-04 01:08:45 UTC (rev 3131) @@ -22,7 +22,6 @@ #include <glib/gi18n.h> #include <math.h> -#include <sys/utsname.h> #include <osb.h> #include "kazehakase.h" @@ -32,6 +31,7 @@ #include "kz-prompt-dialog.h" #include "kz-proxy-item.h" #include "gtk-utils.h" +#include "utils.h" #define GTK_WEBCORE_HAS_MOUSE_DOWN 0 @@ -489,20 +489,10 @@ static void build_user_agent (gchar *user_agent, gint size) { - struct utsname name; gchar *system; - if (uname (&name) >= 0) - { - system = g_strdup_printf ("%s %s", - name.sysname, - name.machine); - } - else - { - system = g_strdup ("Unknown"); - } - + system = kz_utils_get_system_name(); + g_snprintf(user_agent, size, "Mozilla/5.0 (X11; %s; U;) AppleWebKit/146.1 (KHTML, like Gecko) Kazehakase" VERSION, system); Modified: kazehakase/trunk/src/utils/utils.c =================================================================== --- kazehakase/trunk/src/utils/utils.c 2007-04-04 00:03:31 UTC (rev 3130) +++ kazehakase/trunk/src/utils/utils.c 2007-04-04 01:08:45 UTC (rev 3131) @@ -31,6 +31,7 @@ #ifdef HAVE_UNISTD_H # include <unistd.h> #endif +#include <sys/utsname.h> #include "utils.h" #include "glib-utils.h" @@ -1061,6 +1062,26 @@ return last_component_encoded_uri; } +gchar * +kz_utils_get_system_name (void) +{ + struct utsname name; + gchar *system; + + if (uname (&name) >= 0) + { + system = g_strdup_printf ("%s %s", + name.sysname, + name.machine); + } + else + { + system = g_strdup ("Unknown"); + } + + return system; +} + #ifdef G_OS_WIN32 static gchar *win32_base_path = NULL; Modified: kazehakase/trunk/src/utils/utils.h =================================================================== --- kazehakase/trunk/src/utils/utils.h 2007-04-04 00:03:31 UTC (rev 3130) +++ kazehakase/trunk/src/utils/utils.h 2007-04-04 01:08:45 UTC (rev 3131) @@ -82,6 +82,8 @@ gchar *kz_uri_encode_last_component (const gchar *uri); +gchar *kz_utils_get_system_name (void); + #ifdef G_OS_WIN32 const gchar *kz_win32_base_path (void); #endif