]> Pileus Git - ~andy/gtk/blobdiff - gdk/x11/gdkapplaunchcontext-x11.c
Change FSF Address
[~andy/gtk] / gdk / x11 / gdkapplaunchcontext-x11.c
index 7aebfa7847ff0bed063711f4b315f4185a3f44e9..6aa1711e575e7073a7aef7bf6de7bdf2cb4f5d18 100644 (file)
    Library General Public License for more details.
 
    You should have received a copy of the GNU Library General Public
-   License along with the Gnome Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
+   License along with this library. If not, see <http://www.gnu.org/licenses/>.
 
    Author: Alexander Larsson <alexl@redhat.com>
 */
 
 #include "config.h"
 
+#include "gdkx11applaunchcontext.h"
 #include "gdkapplaunchcontextprivate.h"
-
-#include "gdkx.h"
 #include "gdkscreen.h"
 #include "gdkintl.h"
+#include "gdkprivate-x11.h"
 
 #include <glib.h>
 #include <gio/gdesktopappinfo.h>
@@ -128,10 +126,10 @@ end_startup_notification (GdkDisplay *display,
  * timeouts. The reason our timeout is dumb is that we don't monitor
  * the sequence (don't use an SnMonitorContext)
  */
-#define STARTUP_TIMEOUT_LENGTH_SECONDS 30 
+#define STARTUP_TIMEOUT_LENGTH_SECONDS 30
 #define STARTUP_TIMEOUT_LENGTH (STARTUP_TIMEOUT_LENGTH_SECONDS * 1000)
 
-typedef struct 
+typedef struct
 {
   GdkDisplay *display;
   char *startup_id;
@@ -148,7 +146,7 @@ free_startup_notification_data (gpointer data)
   g_free (sn_data);
 }
 
-typedef struct 
+typedef struct
 {
   GSList *contexts;
   guint timeout_id;
@@ -221,7 +219,7 @@ startup_timeout (void *data)
     std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
 
   /* always remove this one, but we may have reinstalled another one. */
-  return FALSE;
+  return G_SOURCE_REMOVE;
 }
 
 
@@ -258,7 +256,7 @@ add_startup_timeout (GdkScreen  *screen,
 
 
 static char *
-gdk_app_launch_context_x11_get_startup_notify_id (GAppLaunchContext *context,
+gdk_x11_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
                                                   GAppInfo          *info,
                                                   GList             *files)
 {
@@ -328,13 +326,15 @@ gdk_app_launch_context_x11_get_startup_notify_id (GAppLaunchContext *context,
       if (icon == NULL)
         {
           icon = g_app_info_get_icon (info);
-          g_object_ref (icon);
+          if (icon != NULL)
+            g_object_ref (icon);
         }
 
-      if (icon)
-        icon_name = gicon_to_string (icon);
-
-      g_object_unref (icon);
+      if (icon != NULL)
+        {
+          icon_name = gicon_to_string (icon);
+          g_object_unref (icon);
+        }
     }
 
   binary_name = g_app_info_get_executable (info);
@@ -388,8 +388,8 @@ gdk_app_launch_context_x11_get_startup_notify_id (GAppLaunchContext *context,
 
 
 static void
-gdk_app_launch_context_x11_launch_failed (GAppLaunchContext *context,
-                                          const char        *startup_notify_id)
+gdk_x11_app_launch_context_launch_failed (GAppLaunchContext *context,
+                                          const gchar       *startup_notify_id)
 {
   GdkAppLaunchContext *ctx;
   GdkScreen *screen;
@@ -429,22 +429,30 @@ gdk_app_launch_context_x11_launch_failed (GAppLaunchContext *context,
     }
 }
 
-typedef GdkAppLaunchContext GdkAppLaunchContextX11;
-typedef GdkAppLaunchContextClass GdkAppLaunchContextX11Class;
+struct _GdkX11AppLaunchContext
+{
+  GdkAppLaunchContext parent_instance;
+};
+
+struct _GdkX11AppLaunchContextClass
+{
+  GdkAppLaunchContextClass parent_class;
+};
+
 
-G_DEFINE_TYPE (GdkAppLaunchContextX11, _gdk_app_launch_context_x11, GDK_TYPE_APP_LAUNCH_CONTEXT)
+G_DEFINE_TYPE (GdkX11AppLaunchContext, gdk_x11_app_launch_context, GDK_TYPE_APP_LAUNCH_CONTEXT)
 
 static void
-_gdk_app_launch_context_x11_class_init (GdkAppLaunchContextX11Class *klass)
+gdk_x11_app_launch_context_class_init (GdkX11AppLaunchContextClass *klass)
 {
   GAppLaunchContextClass *ctx_class = G_APP_LAUNCH_CONTEXT_CLASS (klass);
 
-  ctx_class->get_startup_notify_id = gdk_app_launch_context_x11_get_startup_notify_id;
-  ctx_class->launch_failed = gdk_app_launch_context_x11_launch_failed;
+  ctx_class->get_startup_notify_id = gdk_x11_app_launch_context_get_startup_notify_id;
+  ctx_class->launch_failed = gdk_x11_app_launch_context_launch_failed;
 }
 
 static void
-_gdk_app_launch_context_x11_init (GdkAppLaunchContextX11 *ctx)
+gdk_x11_app_launch_context_init (GdkX11AppLaunchContext *ctx)
 {
 }
 
@@ -453,8 +461,9 @@ _gdk_x11_display_get_app_launch_context (GdkDisplay *display)
 {
   GdkAppLaunchContext *ctx;
 
-  ctx = g_object_new (_gdk_app_launch_context_x11_get_type (), NULL);
-  gdk_app_launch_context_set_display (ctx, display);
+  ctx = g_object_new (GDK_TYPE_X11_APP_LAUNCH_CONTEXT,
+                      "display", display,
+                      NULL);
 
   return ctx;
 }