summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2008-11-25 21:41:23 +0000
committerjstebbins <[email protected]>2008-11-25 21:41:23 +0000
commit54c7e6f7e9f5c2bb57fcca2808fce07aaf0589c9 (patch)
tree90538fbf6bd535335c1067f41fbc8fa1bbba8efd /gtk
parent98d6ebb52840ae25250364cdc002a97560d6c3f1 (diff)
LinGui: make socket connect for appcast run in its own thread. prevents
long delay at startup when there are network issues. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1954 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c16
-rw-r--r--gtk/src/callbacks.h2
-rw-r--r--gtk/src/main.c2
3 files changed, 10 insertions, 10 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 0b8ee4c90..5f2a55a43 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -2699,7 +2699,7 @@ html_link_cb(GtkHTML *html, const gchar *url, signal_user_data_t *ud)
browse_url(url);
}
-static gboolean check_stable_update(signal_user_data_t *ud);
+static gpointer check_stable_update(signal_user_data_t *ud);
static gboolean stable_update_lock = FALSE;
static void
@@ -2724,7 +2724,7 @@ process_appcast(signal_user_data_t *ud)
|| ibuild <= HB_BUILD || skip == ibuild)
{
if (!stable_update_lock && HB_BUILD % 100)
- g_idle_add((GSourceFunc)check_stable_update, ud);
+ g_thread_create((GThreadFunc)check_stable_update, ud, FALSE, NULL);
goto done;
}
msg = g_strdup_printf("HandBrake %s/%s is now available (you have %s/%d).",
@@ -2842,7 +2842,7 @@ ghb_net_open(signal_user_data_t *ud, gchar *address, gint port)
return ioc;
}
-gboolean
+gpointer
ghb_check_update(signal_user_data_t *ud)
{
gchar *query;
@@ -2863,16 +2863,16 @@ ghb_check_update(signal_user_data_t *ud)
}
ioc = ghb_net_open(ud, "handbrake.fr", 80);
if (ioc == NULL)
- return FALSE;
+ return NULL;
g_io_channel_write_chars(ioc, query, strlen(query), &len, &gerror);
g_io_channel_flush(ioc, &gerror);
// This function is initiated by g_idle_add. Must return false
// so that it is not called again
- return FALSE;
+ return NULL;
}
-static gboolean
+static gpointer
check_stable_update(signal_user_data_t *ud)
{
gchar *query;
@@ -2885,12 +2885,12 @@ check_stable_update(signal_user_data_t *ud)
query = "GET /appcast.xml HTTP/1.0\r\nHost: handbrake.fr\r\n\r\n";
ioc = ghb_net_open(ud, "handbrake.fr", 80);
if (ioc == NULL)
- return FALSE;
+ return NULL;
g_io_channel_write_chars(ioc, query, strlen(query), &len, &gerror);
g_io_channel_flush(ioc, &gerror);
// This function is initiated by g_idle_add. Must return false
// so that it is not called again
- return FALSE;
+ return NULL;
}
diff --git a/gtk/src/callbacks.h b/gtk/src/callbacks.h
index 7afaf9d14..e00e641af 100644
--- a/gtk/src/callbacks.h
+++ b/gtk/src/callbacks.h
@@ -46,7 +46,7 @@ GValue* ghb_start_next_job(signal_user_data_t *ud, gboolean find_first);
void ghb_check_dependency(signal_user_data_t *ud, GtkWidget *widget);
void ghb_do_scan(signal_user_data_t *ud, const gchar *filename, gboolean force);
void ghb_log(gchar *log, ...);
-gboolean ghb_check_update(signal_user_data_t *ud);
+gpointer ghb_check_update(signal_user_data_t *ud);
#endif // _CALLBACKS_H_
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 061364b02..9f7b940d3 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -618,7 +618,7 @@ main (int argc, char *argv[])
}
// Reload and check status of the last saved queue
g_idle_add((GSourceFunc)ghb_reload_queue, ud);
- g_idle_add((GSourceFunc)ghb_check_update, ud);
+ g_thread_create((GThreadFunc)ghb_check_update, ud, FALSE, NULL);
// Start timer for monitoring libhb status, 500ms
g_timeout_add (500, ghb_timer_cb, (gpointer)ud);
// Everything should be go-to-go. Lets rock!