From: Roman Moravcik Date: Wed, 27 Apr 2011 14:00:57 +0000 (+0200) Subject: Disable "Show on lenscover open" option of camera-ui application and don't kill camer... X-Git-Tag: v0.3-1~3 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=4e8c7be80f79a5b12ca29770ae7794905a514cfa;p=cl-launcher Disable "Show on lenscover open" option of camera-ui application and don't kill camera-ui process on launcher popup show if camera-ui application is installed from CSSU repository. This will speed up starting of camera application from cl-launcher. --- diff --git a/src/cl-launcher.c b/src/cl-launcher.c index 516e93c..5fba321 100644 --- a/src/cl-launcher.c +++ b/src/cl-launcher.c @@ -44,6 +44,8 @@ #define CAM_FOCUS_UDI "/org/freedesktop/Hal/devices/platform_cam_focus" #define CAM_COVER_STATE "button.state.value" +#define CAMERA_UI_SHOW_ON_LENSCOVER_KEY "/apps/camera/settings/extra-settings/disable-show-on-lenscover-open" + typedef struct _CLLauncherData CLLauncherData; struct _CLLauncherData { GtkWidget *dialog; @@ -53,6 +55,8 @@ struct _CLLauncherData { GtkListStore *application_list; gboolean application_list_empty; + gboolean camera_ui2_installed; + osso_context_t *osso_context; GConfClient *gconf_client; }; @@ -84,6 +88,33 @@ run_application (CLLauncherData *data, DesktopFileInfo *application) } } +static gboolean +check_camera_ui2 (void) +{ + if (system ("test -n \"`dpkg -l camera-ui | grep cssu`\"") == 0) + return TRUE; + else + return FALSE; +} + +static gboolean +check_camera2_show_on_lenscover (CLLauncherData *data) +{ + g_return_if_fail (data); + g_return_if_fail (data->gconf_client); + + return gconf_client_get_bool (data->gconf_client, CAMERA_UI_SHOW_ON_LENSCOVER_KEY, NULL); +} + +static void +disable_camera2_show_on_lenscover (CLLauncherData *data) +{ + g_return_if_fail (data); + g_return_if_fail (data->gconf_client); + + gconf_client_set_bool (data->gconf_client, CAMERA_UI_SHOW_ON_LENSCOVER_KEY, TRUE, NULL); +} + static void kill_camera_application (void) { @@ -306,14 +337,23 @@ camera_launcher_on_hal_property_modified (LibHalContext *ctx, if (state) { switch (data->action) { case CL_LAUNCHER_ACTION_DO_NOTHING: - /* just only kill camera application if it's running */ - kill_camera_application (); + /* + only just kill camera application if it's running. + do nothing if camera2 (from cssu) is installed + */ + if (!data->camera_ui2_installed) + kill_camera_application (); break; case CL_LAUNCHER_ACTION_RUN_PREFERED_APPLICATION: - /* kill camera application only if it's not selected as prefered */ - if (strcmp (data->prefered_application, CAMERA_APPLICATION_DESKTOP_FILE)) - kill_camera_application (); + /* + kill camera application only if it's not selected as prefered, + except camera2 (from cssu) is installed + */ + if (strcmp (data->prefered_application, CAMERA_APPLICATION_DESKTOP_FILE)) { + if (!data->camera_ui2_installed) + kill_camera_application (); + } /* run prefered application */ application = get_desktop_file_info (data->prefered_application); @@ -324,8 +364,12 @@ camera_launcher_on_hal_property_modified (LibHalContext *ctx, break; case CL_LAUNCHER_ACTION_SHOW_SELECTOR_POPUP: - /* kill camera application if it's running */ - kill_camera_application (); + /* + kill camera application if it's running, expect camera2 (from cssu) + is installed. + */ + if (!data->camera_ui2_installed) + kill_camera_application (); /* create selector popup window */ launcher_popup_show (data); @@ -439,6 +483,19 @@ main (int argc, char **argv) libhal_device_add_property_watch (hal, CAM_COVER_UDI, NULL); /* libhal_device_add_property_watch (hal, CAM_FOCUS_UDI, NULL); */ + /* disable showing of camera-ui if camera application from cssu is installed */ + if (check_camera_ui2 ()) { + if (!check_camera2_show_on_lenscover (data)) { + disable_camera2_show_on_lenscover (data); + + /* kill camera-ui process to reload new configuration */ + kill_camera_application (); + } + data->camera_ui2_installed = TRUE; + } else { + data->camera_ui2_installed = FALSE; + } + gtk_main (); /* deinitialize hal */