#if !defined(_WIN32)
#include <poll.h>
-#include <libhal-storage.h>
+#define G_UDEV_API_IS_SUBJECT_TO_CHANGE 1
+#include <gudev/gudev.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <netinet/in.h>
#include <netdb.h>
+
+#if !defined(_NO_UPDATE_CHECK)
#if defined(_OLD_WEBKIT)
#include <webkit.h>
#else
#include <webkit/webkit.h>
#endif
+#endif
+
#include <libnotify/notify.h>
#include <gdk/gdkx.h>
#else
type = GTK_WIDGET_TYPE(widget);
if (type == GTK_TYPE_COMBO_BOX || type == GTK_TYPE_COMBO_BOX_ENTRY)
if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) < 0) return;
- name = gtk_widget_get_name(widget);
+ name = ghb_get_setting_key(widget);
}
else
name = alt_name;
gchar *sourcename;
sourcename = ghb_settings_get_string(ud->settings, "scan_source");
- filename = gtk_action_get_name(action);
+ filename = gtk_buildable_get_name(GTK_BUILDABLE(action));
ghb_do_scan(ud, filename, 0, TRUE);
if (strcmp(sourcename, filename) != 0)
{
G_MODULE_EXPORT void
target_size_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
g_debug("target_size_changed_cb () %s", name);
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
start_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
gint start, end;
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
g_debug("start_point_changed_cb () %s", name);
ghb_widget_to_setting(ud->settings, widget);
end_point_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
gint start, end;
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
g_debug("end_point_changed_cb () %s", name);
ghb_widget_to_setting(ud->settings, widget);
update_preview = FALSE;
}
+#if !defined(_NO_UPDATE_CHECK)
if (!appcast_busy)
{
gchar *updates;
}
}
}
+#endif
return TRUE;
}
g_debug("pref_changed_cb");
ghb_widget_to_setting (ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
ghb_pref_save(ud->settings, name);
}
g_debug("use_m4v_changed_cb");
ghb_widget_to_setting (ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
ghb_pref_save(ud->settings, name);
ghb_update_destination_extension(ud);
}
g_debug("show_status_cb");
ghb_widget_to_setting (ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
ghb_pref_save(ud->settings, name);
GtkStatusIcon *si;
ghb_widget_to_setting (ud->settings, widget);
ghb_check_dependency(ud, widget, NULL);
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
ghb_pref_save(ud->settings, name);
gdouble vqmin, vqmax, step, page;
{
g_debug("tweaks_changed_cb");
ghb_widget_to_setting (ud->settings, widget);
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
ghb_pref_save(ud->settings, name);
}
{
g_debug("hbfd_feature_changed_cb");
ghb_widget_to_setting (ud->settings, widget);
- const gchar *name = gtk_widget_get_name(widget);
+ const gchar *name = ghb_get_setting_key(widget);
ghb_pref_save(ud->settings, name);
gboolean hbfd = ghb_settings_get_boolean(ud->settings, "hbfd_feature");
}
#if !defined(_WIN32)
-static LibHalContext *hal_ctx = NULL;
+static GUdevClient *udev_ctx = NULL;
#endif
gboolean
{
#if !defined(_WIN32)
gchar *device;
- LibHalDrive *halDrive;
- LibHalDriveType dtype;
+ GUdevDevice *udd;
- if (hal_ctx == NULL)
+ if (udev_ctx == NULL)
return FALSE;
device = g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
if (device == NULL)
return FALSE;
- halDrive = libhal_drive_from_device_file (hal_ctx, device);
+
+ udd = g_udev_client_query_by_device_file(udev_ctx, device);
g_free(device);
- if (halDrive == NULL)
+
+ if (udd == NULL)
+ {
+ g_message("udev: Failed to lookup device %s", device);
return FALSE;
- dtype = libhal_drive_get_type(halDrive);
- libhal_drive_free(halDrive);
- return (dtype == LIBHAL_DRIVE_TYPE_CDROM);
+ }
+
+ gint val;
+ val = g_udev_device_get_property_as_int(udd, "ID_CDROM_DVD");
+ if (val == 1)
+ return TRUE;
+
+ return FALSE;
#else
return FALSE;
#endif
}
+void
+ghb_udev_init()
+{
+#if !defined(_WIN32)
+ udev_ctx = g_udev_client_new(NULL);
+#endif
+}
+
#if defined(_WIN32)
static void
handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud)
#endif
#if !defined(_WIN32)
-static void
-dbus_init (void)
-{
- dbus_g_thread_init();
-}
-
#define GPM_DBUS_PM_SERVICE "org.freedesktop.PowerManagement"
#define GPM_DBUS_PM_PATH "/org/freedesktop/PowerManagement"
#define GPM_DBUS_PM_INTERFACE "org.freedesktop.PowerManagement"
#endif
}
+#if !defined(_WIN32)
static gboolean
ghb_can_shutdown_gpm()
{
gboolean can_shutdown = FALSE;
-#if !defined(_WIN32)
DBusGConnection *conn;
DBusGProxy *proxy;
GError *error = NULL;
}
g_object_unref(G_OBJECT(proxy));
dbus_g_connection_unref(conn);
-#endif
return can_shutdown;
}
+#endif
+#if !defined(_WIN32)
static void
ghb_shutdown_gpm()
{
-#if !defined(_WIN32)
DBusGConnection *conn;
DBusGProxy *proxy;
GError *error = NULL;
}
g_object_unref(G_OBJECT(proxy));
dbus_g_connection_unref(conn);
-#endif
}
+#endif
void
ghb_inhibit_gpm()
#endif
}
-void
-ghb_hal_init()
-{
-#if !defined(_WIN32)
- DBusGConnection *gconn;
- DBusConnection *conn;
- GError *gerror = NULL;
- DBusError error;
- char **devices;
- int nr;
-
- dbus_init ();
-
- if (!(hal_ctx = libhal_ctx_new ())) {
- g_warning ("failed to create a HAL context!");
- return;
- }
-
- gconn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &gerror);
- if (gerror != NULL)
- {
- g_warning("DBUS cannot connect: %s", gerror->message);
- g_error_free(gerror);
- return;
- }
- conn = dbus_g_connection_get_connection(gconn);
- libhal_ctx_set_dbus_connection (hal_ctx, conn);
- dbus_error_init (&error);
- if (!libhal_ctx_init (hal_ctx, &error)) {
- g_warning ("libhal_ctx_init failed: %s", error.message ? error.message : "unknown");
- dbus_error_free (&error);
- libhal_ctx_free (hal_ctx);
- dbus_g_connection_unref(gconn);
- hal_ctx = NULL;
- return;
- }
-
- /*
- * Do something to ping the HAL daemon - the above functions will
- * succeed even if hald is not running, so long as DBUS is. But we
- * want to exit silently if hald is not running, to behave on
- * pre-2.6 systems.
- */
- if (!(devices = libhal_get_all_devices (hal_ctx, &nr, &error))) {
- g_warning ("seems that HAL is not running: %s", error.message ? error.message : "unknown");
- dbus_error_free (&error);
-
- libhal_ctx_shutdown (hal_ctx, NULL);
- libhal_ctx_free (hal_ctx);
- hal_ctx = NULL;
- dbus_g_connection_unref(gconn);
- return;
- }
-
- libhal_free_string_array (devices);
- dbus_g_connection_unref(gconn);
-#endif
-}
-
G_MODULE_EXPORT gboolean
tweak_setting_cb(
GtkWidget *widget,
GtkResponseType response;
gchar *tweak = NULL;
- name = gtk_widget_get_name(widget);
+ name = ghb_get_setting_key(widget);
if (g_str_has_prefix(name, "tweak_"))
{
tweak_name = g_strdup(name);
gtk_label_set_text(GTK_LABEL(label), msg);
#if !defined(_WIN32)
+#if !defined(_NO_UPDATE_CHECK)
if (html == NULL)
{
html = webkit_web_view_new();
}
webkit_web_view_open(WEBKIT_WEB_VIEW(html), description);
#endif
+#endif
dialog = GHB_WIDGET(ud->builder, "update_dialog");
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_hide(dialog);
}
if (status == G_IO_STATUS_EOF)
{
- ud->appcast[ud->appcast_len] = 0;
+ if ( ud->appcast != NULL )
+ {
+ ud->appcast[ud->appcast_len] = 0;
+ }
ghb_net_close(ioc);
process_appcast(ud);
return FALSE;