static void
read_iso_3166_entry (xmlTextReaderPtr reader,
		     GHashTable *table)
{
	xmlChar *code, *name;

	code = xmlTextReaderGetAttribute (reader, (const xmlChar *) "alpha_2_code");
	name = xmlTextReaderGetAttribute (reader, (const xmlChar *) "name");

	if (code != NULL && code[0] != '\0' && name != NULL && name[0] != '\0')
	{
		char *lcode;

		lcode = g_ascii_strdown ((char *) code, -1);
		xmlFree (code);

		/* g_print ("%s -> %s\n", lcode, name); */
		
		g_hash_table_insert (table, lcode, name);
	}
	else
	{
		xmlFree (code);
		xmlFree (name);
	}
}
/**
 * nm_setting_wireless_add_seen_bssid:
 * @setting: the #NMSettingWireless
 * @bssid: the new BSSID to add to the list
 *
 * Adds a new Wi-Fi AP's BSSID to the previously seen BSSID list of the setting.
 * NetworkManager now tracks previously seen BSSIDs internally so this function
 * no longer has much use. Actually, changes you make using this function will
 * not be preserved.
 *
 * Returns: %TRUE if @bssid was already known, %FALSE if not
 **/
gboolean
nm_setting_wireless_add_seen_bssid (NMSettingWireless *setting,
                                    const char *bssid)
{
	NMSettingWirelessPrivate *priv;
	char *lower_bssid;
	GSList *iter;
	gboolean found = FALSE;

	g_return_val_if_fail (NM_IS_SETTING_WIRELESS (setting), FALSE);
	g_return_val_if_fail (bssid != NULL, FALSE);

	lower_bssid = g_ascii_strdown (bssid, -1);
	if (!lower_bssid)
		return FALSE;

	priv = NM_SETTING_WIRELESS_GET_PRIVATE (setting);

	for (iter = priv->seen_bssids; iter; iter = iter->next) {
		if (!strcmp ((char *) iter->data, lower_bssid)) {
			found = TRUE;
			break;
		}
	}

	if (!found) {
		priv->seen_bssids = g_slist_prepend (priv->seen_bssids, lower_bssid);
		g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_SEEN_BSSIDS);
	} else
		g_free (lower_bssid);

	return !found;
}
Example #3
0
enum CPU identify_cpu (struct server *s, const char *versionstr) {
	enum CPU cpu = CPU_UNKNOWN;
	gchar *str;

	str = g_ascii_strdown(versionstr, -1);  /* g_ascii_strdown does implicit strndup */
	if (!str)
		return CPU_UNKNOWN;

	if (strstr (str, "x86_64") || strstr (str, "amd64") || strstr(str, "x64"))
		cpu = CPU_X86_64;
	else if (strstr (str, "x86") || strstr (str, "i386"))
		cpu = CPU_X86;
	else if (strstr (str, "sparc"))
		cpu = CPU_SPARC;
	else if (strstr (str, "axp"))
		cpu = CPU_AXP;
	else if (strstr (str, "ppc"))
		cpu = CPU_PPC;
	else {
		debug (3, "identify_cpu() -- [%s %s:%d] Unknown CPU: %s\n", type2id(s->type), 
				inet_ntoa (s->host->ip), s->port, versionstr);
	}
	g_free(str);
	return cpu;
}
Example #4
0
File: core.c Project: heirecka/lgi
static int core_downcase (lua_State *L)
{
  gchar *str = g_ascii_strdown (luaL_checkstring (L, 1), -1);
  lua_pushstring (L, str);
  g_free (str);
  return 1;
}
Example #5
0
GType
gst_sf_minor_types_get_type (void)
{
  static GType sf_minor_types_type = 0;
  static GEnumValue *sf_minor_types = NULL;

  if (!sf_minor_types_type) {
    SF_FORMAT_INFO format_info;
    int k, count;

    sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int));

    sf_minor_types = g_new0 (GEnumValue, count + 1);

    for (k = 0; k < count; k++) {
      format_info.format = k;
      sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &format_info,
          sizeof (format_info));
      sf_minor_types[k].value = format_info.format;
      sf_minor_types[k].value_name = g_strdup (format_info.name);
      sf_minor_types[k].value_nick = g_ascii_strdown (format_info.name, -1);
      g_strcanon ((gchar *) sf_minor_types[k].value_nick,
          G_CSET_a_2_z G_CSET_DIGITS "-", '-');
    }

    sf_minor_types_type =
        g_enum_register_static ("GstSndfileMinorTypes", sf_minor_types);
  }
  return sf_minor_types_type;
}
Example #6
0
static GHashTable * dictionary_from_vorbis_comment (vorbis_comment * vc)
{
    gint i;

    GHashTable * dict = g_hash_table_new_full (g_str_hash, g_str_equal,
     (GDestroyNotify) str_unref, (GDestroyNotify) str_unref);

    for (i = 0; i < vc->comments; i++) {
        gchar **frags;

        AUDDBG("%s\n", vc->user_comments[i]);
        frags = g_strsplit(vc->user_comments[i], "=", 2);

        if (frags[0] && frags[1])
        {
            gchar * key = g_ascii_strdown (frags[0], -1);
            g_hash_table_insert (dict, str_get (key), str_get (frags[1]));
            g_free (key);
        }

        g_strfreev(frags); /* Don't use g_free() for string lists! --eugene */
    }

    return dict;
}
Example #7
0
JS_EXPORT_API
gchar* greeter_get_session_icon (const gchar *key)
{
    gchar* icon = NULL;

    gchar *session = g_ascii_strdown (key, -1);

    if (session == NULL) {
        g_warning("[%s]: session is NULL\n", __func__);
        icon = g_strdup ("unkown");
    } else if (g_str_has_prefix (session, "gnome")){
        icon = g_strdup ("gnome");
    } else if (g_str_has_prefix (session, "deepin")){
        icon = g_strdup ("deepin");
    } else if (g_str_has_prefix (session, "kde")){
        icon = g_strdup ("kde");
    } else if (g_str_has_prefix (session, "ubuntu")){
        icon = g_strdup ("ubuntu");
    } else if (g_str_has_prefix (session, "xfce")){
        icon = g_strdup ("xfce");
    } else if (g_str_has_prefix (session, "lxde")){
        icon = g_strdup ("lxde");
    } else if (g_str_has_prefix (session, "enlightenment")){
        icon = g_strdup ("enlightenment");
    } else if (g_str_has_prefix (session, "fluxbox")){
        icon = g_strdup ("fluxbox");
    } else {
        icon = g_strdup ("unkown");
    }

    g_free (session);

    return icon;
}
static AVInputFormat * get_format_by_extension (const gchar * name)
{
    const gchar * ext0, * sub;
    uri_parse (name, NULL, & ext0, & sub, NULL);

    if (ext0 == sub)
        return NULL;

    gchar * ext = g_ascii_strdown (ext0 + 1, sub - ext0 - 1);

    AUDDBG ("Get format by extension: %s\n", name);
    pthread_mutex_lock (& data_mutex);

    if (! extension_dict)
        extension_dict = create_extension_dict ();

    AVInputFormat * f = g_hash_table_lookup (extension_dict, ext);
    pthread_mutex_unlock (& data_mutex);

    if (f)
        AUDDBG ("Format %s.\n", f->name);
    else
        AUDDBG ("Format unknown.\n");

    g_free (ext);
    return f;
}
static GHashTable * create_extension_dict (void)
{
    GHashTable * dict = g_hash_table_new_full (g_str_hash, g_str_equal,
     (GDestroyNotify) str_unref, NULL);

    AVInputFormat * f;
    for (f = av_iformat_next (NULL); f; f = av_iformat_next (f))
    {
        if (! f->extensions)
            continue;

        gchar * exts = g_ascii_strdown (f->extensions, -1);

        gchar * parse, * next;
        for (parse = exts; parse; parse = next)
        {
            next = strchr (parse, ',');
            if (next)
            {
                * next = 0;
                next ++;
            }

            g_hash_table_insert (dict, str_get(parse), f);
        }

        g_free (exts);
    }

    return dict;
}
Example #10
0
static int
update_user_passwd (CcnetUserManager *manager,
                    const char *email, const char *passwd)
{
    CcnetDB *db = manager->priv->db;
    char *db_passwd = NULL;
    int ret;

    hash_password_pbkdf2_sha256 (passwd, manager->passwd_hash_iter,
                                 &db_passwd);

    /* convert email to lower case for case insensitive lookup. */
    char *email_down = g_ascii_strdown (email, strlen(email));

    ret = ccnet_db_statement_query (db,
                                    "UPDATE EmailUser SET passwd=? WHERE email=?",
                                    2, "string", db_passwd, "string", email_down);

    g_free (db_passwd);
    g_free (email_down);

    if (ret < 0)
        return ret;

    return 0;
}
Example #11
0
static gboolean
get_emailusers_cb (CcnetDBRow *row, void *data)
{
    GList **plist = data;
    CcnetEmailUser *emailuser;

    int id = ccnet_db_row_get_column_int (row, 0);
    const char *email = (const char *)ccnet_db_row_get_column_text (row, 1);
    int is_staff = ccnet_db_row_get_column_int (row, 2);
    int is_active = ccnet_db_row_get_column_int (row, 3);
    gint64 ctime = ccnet_db_row_get_column_int64 (row, 4);
    const char *role = (const char *)ccnet_db_row_get_column_text (row, 5);

    char *email_l = g_ascii_strdown (email, -1);
    emailuser = g_object_new (CCNET_TYPE_EMAIL_USER,
                              "id", id,
                              "email", email_l,
                              "is_staff", is_staff,
                              "is_active", is_active,
                              "ctime", ctime,
                              "role", role ? role : "",
                              "source", "DB", 
                              NULL);
    g_free (email_l);

    *plist = g_list_prepend (*plist, emailuser);

    return TRUE;
}
Example #12
0
/**
 * cinnamon_app_system_lookup_desktop_wmclass:
 * @system: a #CinnamonAppSystem
 * @wmclass: (allow-none): A WM_CLASS value
 *
 * Find a valid application whose .desktop file, without the extension
 * and properly canonicalized, matches @wmclass.
 *
 * Returns: (transfer none): A #CinnamonApp for @wmclass
 */
CinnamonApp *
cinnamon_app_system_lookup_desktop_wmclass (CinnamonAppSystem *system,
                                            const char        *wmclass)
{
  char *canonicalized;
  char *desktop_file;
  char *stripped_name;
  CinnamonApp *app;

  if (wmclass == NULL)
    return NULL;

  canonicalized = g_ascii_strdown (wmclass, -1);

  stripped_name = strip_extension(canonicalized);

  /* This handles "Fedora Eclipse", probably others.
   * Note g_strdelimit is modify-in-place. */
  g_strdelimit (stripped_name, " ", '-');

  desktop_file = g_strconcat (stripped_name, ".desktop", NULL);

  app = cinnamon_app_system_lookup_heuristic_basename (system, desktop_file);

  g_free (canonicalized);
  g_free (stripped_name);
  g_free (desktop_file);

  return app;
}
Example #13
0
int
ns__get_radar_data(soap* soap, int sessionID, char* site, char* product, struct DateTime time, struct RadarData* result)
{
	DarxendClient* client = client_manager_get_client(sessionID);
	if (!client)
		return die_bad_client(soap);

	unsigned int length = 0;

	gchar* psite = g_ascii_strdown(site, -1);
	gchar* pproduct = g_ascii_strup(product, -1);

	char* data = radar_data_manager_read_data(psite, pproduct, time, &length);

	g_free(psite);
	g_free(pproduct);

	if (!data)
		return soap_receiver_fault(soap, "Data not found", NULL);

	gchar* b64data = g_base64_encode((guchar*)data, length);
	free(data);
	result->data = (char*)soap_malloc(soap, strlen(b64data));
	strcpy(result->data, b64data);
	g_free(b64data);

	return SOAP_OK;
}
Example #14
0
char *
export_compress_str(char * buf, int limit) {

	char * str;
	char * valid = "abcdefghijklmnopqrstuvwxyz0123456789";
	int i = 0;
	int j = 0;

	str = g_ascii_strdown(buf, -1);
	g_strcanon(str, valid, '_');

	for (i = 0; str[i]; i++) {
		if (str[i] == '_') {
			continue;
		}
		str[j] = str[i];
		j++;
	}

	if (limit < j) {
		str[limit] = '\0';
	} else if (j > 0) {
		str[j] = '\0';
	} else {
		str[0] = 'x';
		str[1] = '\0';
	}

	return str;
}
Example #15
0
static gboolean
load_css_from_resource (GApplication *application,
                        GtkCssProvider *provider,
                        gboolean theme)
{
  const char *base_path;
  gs_free char *uri;
  gs_unref_object GFile *file;
  gs_free_error GError *error = NULL;

  base_path = g_application_get_resource_base_path (application);

  if (theme) {
    gs_free char *str, *theme_name;

    g_object_get (gtk_settings_get_default (), "gtk-theme-name", &str, NULL);
    theme_name = g_ascii_strdown (str, -1);
    uri = g_strdup_printf ("resource://%s/css/%s/terminal.css", base_path, theme_name);
  } else {
    uri = g_strdup_printf ("resource://%s/css/terminal.css", base_path);
  }

  file = g_file_new_for_uri (uri);
  if (!g_file_query_exists (file, NULL /* cancellable */))
    return FALSE;

  if (!gtk_css_provider_load_from_file (provider, file, &error))
    g_assert_no_error (error);

  return TRUE;
}
Example #16
0
static void
irc_receiving_text(PurpleConnection *gc, const char **incoming, gpointer null)
{
	char **splits, *str;
	PurpleAccount *account = NULL;

	if (!incoming || !*incoming || !**incoming)   /* oh the fun .. I can do this all day! */
		return;

	splits = g_strsplit(*incoming, " ", -1);

	/* if there's not at least 5 elements in the string array, this isn't a kick; ignore  */
	if(g_strv_length(splits) < 5)
		return;

	account = purple_connection_get_account(gc);
	str = g_ascii_strdown(splits[1], -1);

	if (strcmp(str, "kick") == 0 && splits[2] && splits[3]) {
		char *name = splits[2];
		GList *chats = purple_get_chats();
		while (chats) {
			PurpleConversation *conv = chats->data;
			chats = chats->next;
			if (purple_conversation_get_account(conv) == account
					&& strcmp(purple_conversation_get_name(conv), name) == 0) {
				purple_timeout_add(100, show_them, conv);
				break;
			}
		}
	}

	g_free(str);
	g_strfreev(splits);
}
Example #17
0
int gKey::fromString(char *str)
{
	char *lstr;
	int key;
	
	if (!str || !*str)
		return 0;
	
	lstr = g_ascii_strup(str, -1);
	key = gdk_keyval_from_name(lstr);
	g_free(lstr);
	if (key) return key;

	lstr = g_ascii_strdown(str, -1);
	key = gdk_keyval_from_name(lstr);
	g_free(lstr);
	if (key) return key;

	key = gdk_keyval_from_name(str);
	if (key) return key;

	if (!str[1] && isascii(str[0]))
		return str[0];
	else
		return 0;
}
static gchar *
get_locale (void)
{
  const char *loc = NULL;
  gchar *ret;

#ifdef ENABLE_NLS
#if defined(LC_MESSAGES)
  loc = setlocale (LC_MESSAGES, NULL);
  GST_LOG ("LC_MESSAGES: %s", GST_STR_NULL (loc));
#elif defined(LC_ALL)
  loc = setlocale (LC_ALL, NULL);
  GST_LOG ("LC_ALL: %s", GST_STR_NULL (loc));
#else
  GST_LOG ("Neither LC_ALL nor LC_MESSAGES defined");
#endif
#else /* !ENABLE_NLS */
  GST_LOG ("i18n disabled");
#endif

  if (loc == NULL || g_ascii_strncasecmp (loc, "en", 2) == 0)
    return NULL;

  /* en_GB.UTF-8 => en */
  ret = g_ascii_strdown (loc, -1);
  ret = g_strcanon (ret, "abcdefghijklmnopqrstuvwxyz", '\0');
  GST_LOG ("using locale: %s", ret);
  return ret;
}
Example #19
0
static void
theme_changed (GtkSettings *settings,
	       GParamSpec  *pspec,
	       GeditApp    *app)
{
	GeditAppPrivate *priv;

	priv = gedit_app_get_instance_private (app);

	gchar *theme, *lc_theme, *theme_css;

	g_object_get (settings, "gtk-theme-name", &theme, NULL);
	lc_theme = g_ascii_strdown (theme, -1);
	g_free (theme);

	theme_css = g_strdup_printf ("gedit.%s.css", lc_theme);
	g_free (lc_theme);

	if (priv->theme_provider != NULL)
	{
		gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (),
		                                              GTK_STYLE_PROVIDER (priv->theme_provider));
		g_clear_object (&priv->theme_provider);
	}

	priv->theme_provider = load_css_from_resource (theme_css, FALSE);

	g_free (theme_css);
}
Example #20
0
/**
 * as_inf_make_case_insensitive:
 */
static gchar *
as_inf_make_case_insensitive (AsInfHelper *helper, const gchar *text)
{
	if (helper->flags & AS_INF_LOAD_FLAG_CASE_INSENSITIVE)
		return g_ascii_strdown (text, -1);
	return g_strdup (text);
}
Example #21
0
static void
add_basic_env(DBusMessageIter *iter, const gchar *udi) {
  struct utsname un;
  char *server_addr;

  if (hald_is_verbose) {
    add_env(iter, "HALD_VERBOSE", "1");
  }
  if (hald_is_initialising) {
    add_env(iter, "HALD_STARTUP", "1");
  }
  if (hald_use_syslog) {
    add_env(iter, "HALD_USE_SYSLOG", "1");
  }
  add_env(iter, "UDI", udi);
  server_addr = hald_dbus_local_server_addr();
  add_env(iter, "HALD_DIRECT_ADDR", server_addr);
  dbus_free (server_addr);
#ifdef HAVE_POLKIT
  add_env(iter, "HAVE_POLKIT", "1");
#endif

  if (uname(&un) >= 0) {
    char *sysname;

    sysname = g_ascii_strdown(un.sysname, -1);
    add_env(iter, "HALD_UNAME_S", sysname);
    g_free(sysname);
  }
}
static char *
plugin_get_callback_name (const char *action_name,
			  const char *signal_name)
{
	GError        *error = NULL;
	static GRegex *r1 = NULL;
	static GRegex *r2 = NULL;
	char          *a, *b;

	if (G_UNLIKELY (!r1)) {
		r1 = g_regex_new ("(.)([A-Z][a-z])", G_REGEX_OPTIMIZE, 0, &error);

		if (!r1) {
			g_warning ("%s: %s", G_STRFUNC, error->message);
			g_assert_not_reached ();
		}
	}

	if (G_UNLIKELY (!r2)) {
		r2 = g_regex_new ("[-_]+", G_REGEX_OPTIMIZE, 0, &error);

		if (!r2) {
			g_warning ("%s: %s", G_STRFUNC, error->message);
			g_assert_not_reached ();
		}
	}

	a = g_regex_replace (r1, action_name, -1, 0, "\\1_\\2", 0, NULL);
	b = g_strconcat (a, "_", signal_name, NULL);              g_free (a);
	a = g_regex_replace_literal (r2, b, -1, 0, "_", 0, NULL); g_free (b);
	b = g_ascii_strdown (a, -1);                              g_free (a);

	return b;
}
Example #23
0
char *fs_uae_expand_path(const char* path)
{
    char* lower = g_ascii_strdown(path, -1);
    int replace = 0;
    const char *replace_with = NULL;

    if (check_path_prefix(lower, "~", &replace)) {
        replace_with = fs_uae_home_dir();
    } else if (check_path_prefix(lower, "$home", &replace)) {
        replace_with = fs_uae_home_dir();
    } else if (check_path_prefix(lower, "$app", &replace)) {
        replace_with = fs_uae_app_dir();
    } else if (check_path_prefix(lower, "$exe", &replace)) {
        replace_with = fs_uae_exe_dir();
    } else if (check_path_prefix(lower, "$fsuae", &replace)) {
        replace_with = fs_uae_base_dir();
    } else if (check_path_prefix(lower, "$base", &replace)) {
        replace_with = fs_uae_base_dir();
    } else if (check_path_prefix(lower, "$documents", &replace)) {
        replace_with = fs_uae_documents_dir();
    } else if (check_path_prefix(lower, "$config", &replace)) {
        replace_with = g_fs_uae_config_dir_path;
    } else if (check_path_prefix(lower, "$temp", &replace)) {
        replace_with = fs_uae_temp_dir();
    }

    free(lower);
    if (replace_with) {
        const char *src = path + replace;
        return g_build_filename(replace_with, src, NULL);
    } else {
        return g_strdup(path);
    }
}
Example #24
0
static const gchar *
get_method_string (const gchar *substring, gchar **method_string)
{
	const gchar *p;
	char *method;

	for (p = substring;
	     g_ascii_isalnum (*p) || *p == '+' || *p == '-' || *p == '.';
	     p++)
		;

	if (*p == ':'
#ifdef G_OS_WIN32
	              &&
	    !(p == substring + 1 && g_ascii_isalpha (*substring))
#endif
								 ) {
		/* Found toplevel method specification.  */
		method = g_strndup (substring, p - substring);
		*method_string = g_ascii_strdown (method, -1);
		g_free (method);
		p++;
	} else {
		*method_string = g_strdup ("file");
		p = substring;
	}
	return p;
}
Example #25
0
static gchar *
get_current_locale_name (void)
{
	char *locale;
	char *p, *ret;
		
#ifdef HOST_WIN32
	locale = g_win32_getlocale ();
#elif defined (__APPLE__)	
	locale = get_darwin_locale ();
	if (!locale)
		locale = get_posix_locale ();
#else
	locale = get_posix_locale ();
#endif

	if (locale == NULL)
		return NULL;

	p = strchr (locale, '.');
	if (p != NULL)
		*p = 0;
	p = strchr (locale, '@');
	if (p != NULL)
		*p = 0;
	p = strchr (locale, '_');
	if (p != NULL)
		*p = '-';

	ret = g_ascii_strdown (locale, -1);
	g_free (locale);

	return ret;
}
Example #26
0
/**
 * Creates a new HMTL url.
 *
 * @param type URL type
 * @param location URL location
 * @param label URL label (optional)
 * @return Newly created URL.  This string must be freed by the caller.
 */
gchar*
gnc_build_url( URLType type, const gchar* location, const gchar* label )
{
    URLType  lc_type  = NULL;
    char * type_name;

    DEBUG(" ");
    lc_type = g_ascii_strdown (type, -1);
    type_name = g_hash_table_lookup (gnc_html_type_to_proto_hash, lc_type);
    g_free (lc_type);
    if (!type_name)
        type_name = "";

    if (label)
    {
        return g_strdup_printf("%s%s%s#%s", type_name, (*type_name ? ":" : ""),
                               (location ? location : ""),
                               label ? label : "");
    }
    else
    {
        return g_strdup_printf("%s%s%s", type_name, (*type_name ? ":" : ""),
                               (location ? location : ""));
    }
}
static gboolean get_config (GKeyFile *pKeyFile, CairoConfigTaskBar *pTaskBar)
{
	gboolean bFlushConfFileNeeded = FALSE;
	
	pTaskBar->bShowAppli = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "show applications", &bFlushConfFileNeeded, TRUE, "Applications", NULL);
	
	///pTaskBar->bUniquePid = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "unique PID", &bFlushConfFileNeeded, FALSE, "Applications", NULL);
	
	pTaskBar->bGroupAppliByClass = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "group by class", &bFlushConfFileNeeded, TRUE, "Applications", NULL);
	pTaskBar->cGroupException = cairo_dock_get_string_key_value (pKeyFile, "TaskBar", "group exception", &bFlushConfFileNeeded, "pidgin;xchat", NULL, NULL);
	if (pTaskBar->cGroupException)
	{
		int i;
		for (i = 0; pTaskBar->cGroupException[i] != '\0'; i ++)
			pTaskBar->cGroupException[i] = g_ascii_tolower (pTaskBar->cGroupException[i]);
	}
	
	pTaskBar->iAppliMaxNameLength = cairo_dock_get_integer_key_value (pKeyFile, "TaskBar", "max name length", &bFlushConfFileNeeded, 15, "Applications", NULL);

	pTaskBar->bMinimizeOnClick = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "minimize on click", &bFlushConfFileNeeded, TRUE, "Applications", NULL);
	pTaskBar->bCloseAppliOnMiddleClick = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "close on middle click", &bFlushConfFileNeeded, TRUE, "Applications", NULL);

	pTaskBar->bHideVisibleApplis = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "hide visible", &bFlushConfFileNeeded, FALSE, "Applications", NULL);
	pTaskBar->fVisibleAppliAlpha = cairo_dock_get_double_key_value (pKeyFile, "TaskBar", "visibility alpha", &bFlushConfFileNeeded, .35, "Applications", NULL);  // >0 <=> les fenetres minimisees sont transparentes.
	if (pTaskBar->bHideVisibleApplis && pTaskBar->fVisibleAppliAlpha < 0)
		pTaskBar->fVisibleAppliAlpha = 0.;  // on inhibe ce parametre, puisqu'il ne sert alors a rien.
	else if (pTaskBar->fVisibleAppliAlpha > .6)
		pTaskBar->fVisibleAppliAlpha = .6;
	else if (pTaskBar->fVisibleAppliAlpha < -.6)
		pTaskBar->fVisibleAppliAlpha = -.6;
	pTaskBar->bAppliOnCurrentDesktopOnly = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "current desktop only", &bFlushConfFileNeeded, FALSE, "Applications", NULL);
	
	pTaskBar->bDemandsAttentionWithDialog = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "demands attention with dialog", &bFlushConfFileNeeded, TRUE, "Applications", NULL);
	pTaskBar->iDialogDuration = cairo_dock_get_integer_key_value (pKeyFile, "TaskBar", "duration", &bFlushConfFileNeeded, 2, NULL, NULL);
	pTaskBar->cAnimationOnDemandsAttention = cairo_dock_get_string_key_value (pKeyFile, "TaskBar", "animation on demands attention", &bFlushConfFileNeeded, "fire", NULL, NULL);
	gchar *cForceDemandsAttention = cairo_dock_get_string_key_value (pKeyFile, "TaskBar", "force demands attention", &bFlushConfFileNeeded, "pidgin;xchat", NULL, NULL);
	pTaskBar->cForceDemandsAttention = g_ascii_strdown (cForceDemandsAttention, -1);
	g_free (cForceDemandsAttention);
	
	pTaskBar->cAnimationOnActiveWindow = cairo_dock_get_string_key_value (pKeyFile, "TaskBar", "animation on active window", &bFlushConfFileNeeded, "wobbly", NULL, NULL);
	
	pTaskBar->bMixLauncherAppli = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "mix launcher appli", &bFlushConfFileNeeded, TRUE, NULL, NULL);
	pTaskBar->bDrawIndicatorOnAppli = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "indic on appli", &bFlushConfFileNeeded, FALSE, NULL, NULL);
	pTaskBar->bOverWriteXIcons = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "overwrite xicon", &bFlushConfFileNeeded, TRUE, NULL, NULL);
	pTaskBar->cOverwriteException = cairo_dock_get_string_key_value (pKeyFile, "TaskBar", "overwrite exception", &bFlushConfFileNeeded, "pidgin;xchat", NULL, NULL);
	if (pTaskBar->cOverwriteException)
	{
		int i;
		for (i = 0; pTaskBar->cOverwriteException[i] != '\0'; i ++)
			pTaskBar->cOverwriteException[i] = g_ascii_tolower (pTaskBar->cOverwriteException[i]);
	}
	pTaskBar->bShowThumbnail = cairo_dock_get_boolean_key_value (pKeyFile, "TaskBar", "window thumbnail", &bFlushConfFileNeeded, TRUE, NULL, NULL);
	if (pTaskBar->bShowThumbnail && ! cairo_dock_xcomposite_is_available ())
	{
		cd_warning ("Sorry but either your X server does not have the XComposite extension, or your version of Cairo-Dock was not built with the support of XComposite.\n You can't have window thumbnails in the dock");
		pTaskBar->bShowThumbnail = FALSE;
	}

	return bFlushConfFileNeeded;
}
Example #28
0
void
gnc_html_unregister_url_handler( URLType url_type )
{
    URLType lc_type = g_ascii_strdown (url_type, -1);
    g_hash_table_remove( gnc_html_url_handlers, lc_type );
    g_free(lc_type);
}
Example #29
0
/*
 * Construct a ini section key for contact
 * @param server irssi server record
 * @param contactPtr contact
 * @param iniSectionKey buffer to there the section key is generated
 * @return TRUE if everything ok FALSE if not
 */
int getIniSectionForContact(const SERVER_REC * serverRec,
			     const char *contactPtr, char *iniSectionKey)
{
	char *target;

	ZeroMemory(iniSectionKey, CONTACT_SIZE);

	if (contactPtr == NULL)
		return FALSE;

	if (iniSectionKey == NULL)
		return FALSE;
	
	target = g_ascii_strdown((gchar*)contactPtr, (gssize)strlen(contactPtr));

	if (serverRec != NULL) {
		snprintf(iniSectionKey, CONTACT_SIZE, "%s:%s", serverRec->tag,
			 target);
	} else {
		snprintf(iniSectionKey, CONTACT_SIZE, "%s", contactPtr);
	}

	// replace '[' and ']' with '~' in contact name
	// TODO: maybe this isnt needed anymoar
	FixIniSection(NULL, iniSectionKey);

	return TRUE;
}
Example #30
0
File: pbap.c Project: Sork007/obexd
static gchar *build_phonebook_path(const char *location, const char *item)
{
	gchar *path = NULL, *tmp, *tmp1;

	if (!g_ascii_strcasecmp(location, "INT") ||
			!g_ascii_strcasecmp(location, "INTERNAL"))
		path = g_strdup("telecom");
	else if (!g_ascii_strncasecmp(location, "SIM", 3)) {
		if (strlen(location) == 3)
			tmp = g_strdup("SIM1");
		else
			tmp = g_ascii_strup(location, 4);

		path = g_build_filename(tmp, "telecom", NULL);
		g_free(tmp);
	} else
		return NULL;

	if (!g_ascii_strcasecmp(item, "PB") ||
		!g_ascii_strcasecmp(item, "ICH") ||
		!g_ascii_strcasecmp(item, "OCH") ||
		!g_ascii_strcasecmp(item, "MCH") ||
		!g_ascii_strcasecmp(item, "CCH")) {
		tmp = path;
		tmp1 = g_ascii_strdown(item, -1);
		path = g_build_filename(tmp, tmp1, NULL);
		g_free(tmp);
		g_free(tmp1);
	} else {
		g_free(path);
		return NULL;
	}

	return path;
}