gboolean window_menu_applet_fill(MatePanelApplet* applet) { WindowMenu* window_menu; GtkActionGroup* action_group; gchar* ui_path; window_menu = g_new0(WindowMenu, 1); window_menu->applet = GTK_WIDGET(applet); force_no_focus_padding(window_menu->applet); gtk_widget_set_tooltip_text(window_menu->applet, _("Window Selector")); mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR); window_menu->size = mate_panel_applet_get_size(applet); window_menu->orient = mate_panel_applet_get_orient(applet); g_signal_connect(window_menu->applet, "destroy", G_CALLBACK(window_menu_destroy), window_menu); action_group = gtk_action_group_new("WindowMenu Applet Actions"); gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(action_group, window_menu_actions, G_N_ELEMENTS(window_menu_actions), window_menu); ui_path = g_build_filename(WNCK_MENU_UI_DIR, "window-menu-menu.xml", NULL); mate_panel_applet_setup_menu_from_file(applet, ui_path, action_group); g_free(ui_path); g_object_unref(action_group); window_menu->selector = wnck_selector_new(); gtk_container_add(GTK_CONTAINER(window_menu->applet), window_menu->selector); mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(window_menu->applet), GTK_WIDGET(window_menu->selector)); g_signal_connect(window_menu->applet, "key_press_event", G_CALLBACK(window_menu_key_press_event), window_menu); g_signal_connect(window_menu->applet, "size-allocate", G_CALLBACK(window_menu_size_allocate), window_menu); g_signal_connect_after(G_OBJECT(window_menu->applet), "focus-in-event", G_CALLBACK(gtk_widget_queue_draw), window_menu); g_signal_connect_after(G_OBJECT(window_menu->applet), "focus-out-event", G_CALLBACK(gtk_widget_queue_draw), window_menu); #if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect_after(G_OBJECT(window_menu->selector), "draw", G_CALLBACK(window_menu_on_draw), window_menu); #else g_signal_connect_after(G_OBJECT(window_menu->selector), "expose-event", G_CALLBACK(window_menu_on_expose), window_menu); #endif g_signal_connect(G_OBJECT(window_menu->selector), "button_press_event", G_CALLBACK(filter_button_press), window_menu); gtk_widget_show_all(GTK_WIDGET(window_menu->applet)); return TRUE; }
static void cpufreq_applet_init (CPUFreqApplet *applet) { applet->prefs = NULL; applet->popup = NULL; applet->monitor = NULL; applet->label = gtk_label_new (NULL); applet->unit_label = gtk_label_new (NULL); applet->icon = gtk_image_new (); applet->box = NULL; applet->show_mode = CPUFREQ_MODE_BOTH; applet->show_text_mode = CPUFREQ_MODE_TEXT_FREQUENCY_UNIT; applet->need_refresh = TRUE; mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_EXPAND_MINOR); #if !GTK_CHECK_VERSION (3, 0, 0) mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (applet), GTK_WIDGET (applet)); #endif applet->size = mate_panel_applet_get_size (MATE_PANEL_APPLET (applet)); applet->orient = mate_panel_applet_get_orient (MATE_PANEL_APPLET (applet)); switch (applet->orient) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: applet->container = gtk_alignment_new (0.5, 0.5, 0, 0); break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: applet->container = gtk_alignment_new (0, 0.5, 0, 0); break; } gtk_container_add (GTK_CONTAINER (applet), applet->container); gtk_widget_show (applet->container); }
static void workrave_applet_fill(WorkraveApplet *applet) { mate_panel_applet_set_flags(applet->applet, MATE_PANEL_APPLET_HAS_HANDLE); mate_panel_applet_set_background_widget(applet->applet, GTK_WIDGET(applet->applet)); applet->timerbox_control = g_object_new(WORKRAVE_TIMERBOX_CONTROL_TYPE, NULL); applet->image = workrave_timerbox_control_get_image(applet->timerbox_control); g_signal_connect(G_OBJECT(applet->timerbox_control), "menu-changed", G_CALLBACK(on_menu_changed), applet); g_signal_connect(G_OBJECT(applet->timerbox_control), "alive-changed", G_CALLBACK(on_alive_changed), applet); workrave_timerbox_control_set_tray_icon_visible_when_not_running(applet->timerbox_control, TRUE); workrave_timerbox_control_set_tray_icon_mode(applet->timerbox_control, WORKRAVE_TIMERBOX_CONTROL_TRAY_ICON_MODE_ALWAYS); applet->action_group = gtk_action_group_new("WorkraveAppletActions"); gtk_action_group_set_translation_domain(applet->action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(applet->action_group, menu_actions, G_N_ELEMENTS (menu_actions), applet); gtk_action_group_add_toggle_actions(applet->action_group, toggle_actions, G_N_ELEMENTS (toggle_actions), applet); gtk_action_group_add_radio_actions (applet->action_group, mode_actions, G_N_ELEMENTS(mode_actions), 0, G_CALLBACK(on_menu_radio_changed), applet); gchar *ui_path = g_build_filename(WORKRAVE_MENU_UI_DIR, "workrave-menu.xml", NULL); mate_panel_applet_setup_menu_from_file(applet->applet, ui_path, applet->action_group); g_free(ui_path); gtk_container_add(GTK_CONTAINER(applet->applet), GTK_WIDGET(applet->image)); gtk_widget_show_all(GTK_WIDGET(applet->applet)); }
static void xmonad_log_applet_fill(GtkContainer *container) #endif { #ifdef PANEL_GNOME panel_applet_set_flags( applet, PANEL_APPLET_EXPAND_MAJOR | PANEL_APPLET_EXPAND_MINOR | PANEL_APPLET_HAS_HANDLE); panel_applet_set_background_widget(applet, GTK_WIDGET(applet)); #endif #ifdef PANEL_MATE mate_panel_applet_set_flags( applet, MATE_PANEL_APPLET_EXPAND_MAJOR | MATE_PANEL_APPLET_EXPAND_MINOR | MATE_PANEL_APPLET_HAS_HANDLE); mate_panel_applet_set_background_widget(applet, GTK_WIDGET(applet)); #endif GtkWidget *label = gtk_label_new("Waiting for Xmonad..."); gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); gtk_label_set_use_markup(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); set_up_dbus_transfer(label); #ifndef PANEL_XFCE4 gtk_container_add(GTK_CONTAINER(applet), label); gtk_widget_show_all(GTK_WIDGET(applet)); return TRUE; #else gtk_container_add(container, label); #endif }
static void trash_applet_init (TrashApplet *applet) { const GtkTargetEntry drop_types[] = { { "text/uri-list" } }; /* needed to clamp ourselves to the panel size */ mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_EXPAND_MINOR); #if !GTK_CHECK_VERSION (3, 0, 0) /* enable transparency hack */ mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (applet), GTK_WIDGET (applet)); #endif /* setup the image */ applet->image = g_object_ref_sink (gtk_image_new ()); gtk_container_add (GTK_CONTAINER (applet), GTK_WIDGET (applet->image)); gtk_widget_show (GTK_WIDGET (applet->image)); /* setup the trash backend */ applet->trash = g_file_new_for_uri ("trash:/"); applet->trash_monitor = g_file_monitor_file (applet->trash, 0, NULL, NULL); g_signal_connect_swapped (applet->trash_monitor, "changed", G_CALLBACK (trash_applet_monitor_changed), applet); /* setup drag and drop */ gtk_drag_dest_set (GTK_WIDGET (applet), GTK_DEST_DEFAULT_ALL, drop_types, G_N_ELEMENTS (drop_types), GDK_ACTION_MOVE); /* synthesise the first update */ applet->items = -1; trash_applet_monitor_changed (applet); }
gboolean window_list_applet_fill(MatePanelApplet* applet) { TasklistData* tasklist; GtkActionGroup* action_group; gchar* ui_path; tasklist = g_new0(TasklistData, 1); tasklist->applet = GTK_WIDGET(applet); mate_panel_applet_set_flags(MATE_PANEL_APPLET(tasklist->applet), MATE_PANEL_APPLET_EXPAND_MAJOR | MATE_PANEL_APPLET_EXPAND_MINOR | MATE_PANEL_APPLET_HAS_HANDLE); setup_gsettings(tasklist); tasklist->include_all_workspaces = g_settings_get_boolean (tasklist->settings, "display-all-workspaces"); tasklist->grouping = g_settings_get_enum (tasklist->settings, "group-windows"); tasklist->move_unminimized_windows = g_settings_get_boolean (tasklist->settings, "move-unminimized-windows"); tasklist->size = mate_panel_applet_get_size(applet); switch (mate_panel_applet_get_orient(applet)) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: tasklist->orientation = GTK_ORIENTATION_VERTICAL; break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: default: tasklist->orientation = GTK_ORIENTATION_HORIZONTAL; break; } #ifdef WNCK_CHECK_VERSION #if WNCK_CHECK_VERSION (3, 0, 0) tasklist->tasklist = wnck_tasklist_new(); #else tasklist->tasklist = wnck_tasklist_new(NULL); #endif #else tasklist->tasklist = wnck_tasklist_new(NULL); #endif #ifdef WNCK_CHECK_VERSION #if WNCK_CHECK_VERSION (3, 4, 6) wnck_tasklist_set_orientation (WNCK_TASKLIST (tasklist->tasklist), tasklist->orientation); wnck_tasklist_set_middle_click_close (WNCK_TASKLIST (tasklist->tasklist), TRUE); #endif #endif wnck_tasklist_set_icon_loader(WNCK_TASKLIST(tasklist->tasklist), icon_loader_func, tasklist, NULL); g_signal_connect(G_OBJECT(tasklist->tasklist), "destroy", G_CALLBACK(destroy_tasklist), tasklist); #if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect(G_OBJECT(tasklist->applet), "size_allocate", G_CALLBACK(applet_size_allocate), tasklist); #else g_signal_connect(G_OBJECT(tasklist->applet), "size_request", G_CALLBACK(applet_size_request), tasklist); #endif tasklist_update(tasklist); gtk_widget_show(tasklist->tasklist); gtk_container_add(GTK_CONTAINER(tasklist->applet), tasklist->tasklist); g_signal_connect(G_OBJECT(tasklist->applet), "realize", G_CALLBACK(applet_realized), tasklist); g_signal_connect(G_OBJECT(tasklist->applet), "change_orient", G_CALLBACK(applet_change_orient), tasklist); g_signal_connect(G_OBJECT(tasklist->applet), "change_size", G_CALLBACK(applet_change_pixel_size), tasklist); g_signal_connect(G_OBJECT(tasklist->applet), "change_background", G_CALLBACK(applet_change_background), tasklist); mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(tasklist->applet), GTK_WIDGET(tasklist->applet)); action_group = gtk_action_group_new("Tasklist Applet Actions"); gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(action_group, tasklist_menu_actions, G_N_ELEMENTS(tasklist_menu_actions), tasklist); /* disable the item of system monitor, if not exists. * example, mate-system-monitor, o gnome-system-monitor */ char* programpath; int i; for (i = 0; i < G_N_ELEMENTS(system_monitors); i += 1) { programpath = g_find_program_in_path(system_monitors[i]); if (programpath != NULL) { g_free(programpath); /* we give up */ goto _system_monitor_found; } /* search another */ } /* system monitor not found */ gtk_action_set_visible(gtk_action_group_get_action(action_group, "TasklistSystemMonitor"), FALSE); _system_monitor_found:; /* end of system monitor item */ ui_path = g_build_filename(WNCK_MENU_UI_DIR, "window-list-menu.xml", NULL); mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(tasklist->applet), ui_path, action_group); g_free(ui_path); if (mate_panel_applet_get_locked_down(MATE_PANEL_APPLET(tasklist->applet))) { GtkAction* action; action = gtk_action_group_get_action(action_group, "TasklistPreferences"); gtk_action_set_visible(action, FALSE); } g_object_unref(action_group); gtk_widget_show(tasklist->applet); return TRUE; }
void mateweather_applet_create (MateWeatherApplet *gw_applet) { GtkActionGroup *action_group; gchar *ui_path; AtkObject *atk_obj; gw_applet->mateweather_pref.location = NULL; gw_applet->mateweather_pref.show_notifications = FALSE; gw_applet->mateweather_pref.update_interval = 1800; gw_applet->mateweather_pref.update_enabled = TRUE; gw_applet->mateweather_pref.detailed = FALSE; gw_applet->mateweather_pref.radar_enabled = TRUE; gw_applet->mateweather_pref.temperature_unit = TEMP_UNIT_INVALID; gw_applet->mateweather_pref.speed_unit = SPEED_UNIT_INVALID; gw_applet->mateweather_pref.pressure_unit = PRESSURE_UNIT_INVALID; gw_applet->mateweather_pref.distance_unit = DISTANCE_UNIT_INVALID; mate_panel_applet_set_flags (gw_applet->applet, MATE_PANEL_APPLET_EXPAND_MINOR); mate_panel_applet_set_background_widget(gw_applet->applet, GTK_WIDGET(gw_applet->applet)); g_set_application_name (_("Weather Report")); gtk_window_set_default_icon_name ("weather-storm"); gw_applet->container = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_container_add (GTK_CONTAINER (gw_applet->applet), gw_applet->container); g_signal_connect (G_OBJECT(gw_applet->applet), "change_orient", G_CALLBACK(change_orient_cb), gw_applet); g_signal_connect (G_OBJECT(gw_applet->applet), "size_allocate", G_CALLBACK(size_allocate_cb), gw_applet); g_signal_connect (G_OBJECT(gw_applet->applet), "destroy", G_CALLBACK (applet_destroy), gw_applet); g_signal_connect (GTK_OBJECT(gw_applet->applet), "button_press_event", G_CALLBACK(clicked_cb), gw_applet); g_signal_connect (G_OBJECT(gw_applet->applet), "key_press_event", G_CALLBACK(key_press_cb), gw_applet); gtk_widget_set_tooltip_text (GTK_WIDGET(gw_applet->applet), _("MATE Weather")); atk_obj = gtk_widget_get_accessible (GTK_WIDGET (gw_applet->applet)); if (GTK_IS_ACCESSIBLE (atk_obj)) atk_object_set_name (atk_obj, _("MATE Weather")); gw_applet->size = mate_panel_applet_get_size (gw_applet->applet); gw_applet->orient = mate_panel_applet_get_orient (gw_applet->applet); action_group = gtk_action_group_new ("MateWeather Applet Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (action_group, weather_applet_menu_actions, G_N_ELEMENTS (weather_applet_menu_actions), gw_applet); ui_path = g_build_filename (MATEWEATHER_MENU_UI_DIR, "mateweather-applet-menu.xml", NULL); mate_panel_applet_setup_menu_from_file (gw_applet->applet, ui_path, action_group); g_free (ui_path); if (mate_panel_applet_get_locked_down (gw_applet->applet)) { GtkAction *action; action = gtk_action_group_get_action (action_group, "Props"); gtk_action_set_visible (action, FALSE); } g_object_unref (action_group); place_widgets(gw_applet); #ifdef HAVE_NETWORKMANAGER setup_network_monitor (gw_applet); #endif }
static gboolean bubblemon_applet_fill(BubblemonApplet *bubblemon_applet, MatePanelApplet *applet) { GtkWidget *drawingArea; GtkActionGroup *actionGroup; gchar *uiPath; mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR); bubblemon_applet->applet = GTK_WIDGET (applet); bubblemon_applet->width = 0; bubblemon_applet->height= 0; g_signal_connect (G_OBJECT (bubblemon_applet->applet), "destroy", G_CALLBACK (applet_destroy), bubblemon_applet); drawingArea = gtk_drawing_area_new(); g_assert(drawingArea != NULL); bubblemon_applet->drawingArea = drawingArea; gtk_widget_set_size_request(GTK_WIDGET(drawingArea), RELATIVE_WIDTH, RELATIVE_HEIGHT); g_signal_connect (G_OBJECT (drawingArea), "configure_event", G_CALLBACK (applet_reconfigure), bubblemon_applet); gtk_widget_set_events(drawingArea, GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_STRUCTURE_MASK); gtk_container_add(GTK_CONTAINER (bubblemon_applet->applet), drawingArea); g_signal_connect_after(drawingArea, "realize", G_CALLBACK(ui_realize), bubblemon_applet); g_signal_connect(drawingArea, "expose_event", G_CALLBACK(ui_expose), bubblemon_applet); gtk_widget_show_all (GTK_WIDGET (bubblemon_applet->applet)); actionGroup = gtk_action_group_new("Bubblemon Applet Actions"); gtk_action_group_set_translation_domain(actionGroup, GETTEXT_PACKAGE); gtk_action_group_add_actions(actionGroup, bubblemon_menu_actions, G_N_ELEMENTS(bubblemon_menu_actions), bubblemon_applet); uiPath = g_build_filename(BUBBLEMON_MENU_UI_DIR, "bubblemon-menu.xml", NULL); mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(bubblemon_applet->applet), uiPath, actionGroup); g_free(uiPath); g_object_unref(actionGroup); bubblemon_applet->refresh_timeout_id = g_timeout_add(1000 / FRAMERATE, ui_timeoutHandler, bubblemon_applet); bubblemon_applet->tooltip_timeout_id = g_timeout_add(2000, update_tooltip, bubblemon_applet); return TRUE; }
static gboolean geyes_applet_fill (MatePanelApplet *applet) { EyesApplet *eyes_applet; GtkActionGroup *action_group; gchar *ui_path; g_set_application_name (_("Eyes")); gtk_window_set_default_icon_name ("mate-eyes-applet"); mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR); eyes_applet = create_eyes (applet); mate_panel_applet_add_preferences (applet, "/schemas/apps/geyes/prefs", NULL); eyes_applet->timeout_id = g_timeout_add ( UPDATE_TIMEOUT, (GtkFunction) timer_cb, eyes_applet); action_group = gtk_action_group_new ("Geyes Applet Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (action_group, geyes_applet_menu_actions, G_N_ELEMENTS (geyes_applet_menu_actions), eyes_applet); ui_path = g_build_filename (GEYES_MENU_UI_DIR, "geyes-applet-menu.xml", NULL); mate_panel_applet_setup_menu_from_file (eyes_applet->applet, ui_path, action_group); g_free (ui_path); if (mate_panel_applet_get_locked_down (eyes_applet->applet)) { GtkAction *action; action = gtk_action_group_get_action (action_group, "Props"); gtk_action_set_visible (action, FALSE); } g_object_unref (action_group); gtk_widget_set_tooltip_text (GTK_WIDGET (eyes_applet->applet), _("Eyes")); set_atk_name_description (GTK_WIDGET (eyes_applet->applet), _("Eyes"), _("The eyes look in the direction of the mouse pointer")); g_signal_connect (eyes_applet->applet, "change_background", G_CALLBACK (applet_back_change), eyes_applet); g_signal_connect (eyes_applet->vbox, "destroy", G_CALLBACK (destroy_cb), eyes_applet); gtk_widget_show_all (GTK_WIDGET (eyes_applet->applet)); /* setup here and not in create eyes so the destroy signal is set so * that when there is an error within loading the theme * we can emit this signal */ if (properties_load (eyes_applet) == FALSE) return FALSE; setup_eyes (eyes_applet); return TRUE; }
static gboolean command_applet_fill (MatePanelApplet* applet) { CommandApplet *command_applet; g_set_application_name (_("Command Applet")); gtk_window_set_default_icon_name (APPLET_ICON); mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR); mate_panel_applet_set_background_widget (applet, GTK_WIDGET (applet)); command_applet = g_malloc0(sizeof(CommandApplet)); command_applet->applet = applet; command_applet->settings = mate_panel_applet_settings_new (applet, COMMAND_SCHEMA); command_applet->interval = g_settings_get_int (command_applet->settings, INTERVAL_KEY); command_applet->command = g_settings_get_string (command_applet->settings, COMMAND_KEY); command_applet->width = g_settings_get_int (command_applet->settings, WIDTH_KEY); command_applet->box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); command_applet->image = GTK_IMAGE (gtk_image_new_from_icon_name (APPLET_ICON, 24)); command_applet->label = GTK_LABEL (gtk_label_new (ERROR_OUTPUT)); command_applet->timeout_id = 0; /* we add the Gtk label into the applet */ gtk_box_pack_start (command_applet->box, GTK_WIDGET (command_applet->image), TRUE, TRUE, 0); gtk_box_pack_start (command_applet->box, GTK_WIDGET (command_applet->label), TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER (applet), GTK_WIDGET (command_applet->box)); gtk_widget_show_all (GTK_WIDGET (command_applet->applet)); g_signal_connect(G_OBJECT (command_applet->applet), "destroy", G_CALLBACK (command_applet_destroy), command_applet); /* GSettings signals */ g_signal_connect(command_applet->settings, "changed::" COMMAND_KEY, G_CALLBACK (settings_command_changed), command_applet); g_signal_connect(command_applet->settings, "changed::" INTERVAL_KEY, G_CALLBACK (settings_interval_changed), command_applet); g_signal_connect(command_applet->settings, "changed::" WIDTH_KEY, G_CALLBACK (settings_width_changed), command_applet); g_settings_bind (command_applet->settings, SHOW_ICON_KEY, command_applet->image, "visible", G_SETTINGS_BIND_DEFAULT); /* set up context menu */ GtkActionGroup *action_group = gtk_action_group_new ("Command Applet Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (action_group, applet_menu_actions, G_N_ELEMENTS (applet_menu_actions), command_applet); mate_panel_applet_setup_menu (command_applet->applet, ui, action_group); /* first command execution */ command_execute (command_applet); return TRUE; }
static void gdict_applet_init (GdictApplet *applet) { GdictAppletPrivate *priv; gchar *data_dir; priv = GDICT_APPLET_GET_PRIVATE (applet); applet->priv = priv; if (!priv->loader) priv->loader = gdict_source_loader_new (); /* add our data dir inside $HOME to the loader's search paths */ data_dir = gdict_get_data_dir (); gdict_source_loader_add_search_path (priv->loader, data_dir); g_free (data_dir); gtk_window_set_default_icon_name ("accessories-dictionary"); mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_EXPAND_MINOR); priv->settings = g_settings_new (GDICT_SETTINGS_SCHEMA); priv->desktop_settings = g_settings_new (DESKTOP_SETTINGS_SCHEMA); g_signal_connect (priv->settings, "changed", G_CALLBACK (gdict_applet_settings_changed_cb), applet); g_signal_connect (priv->desktop_settings, "changed", G_CALLBACK (gdict_applet_settings_changed_cb), applet); mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (applet), GTK_WIDGET (applet)); priv->size = mate_panel_applet_get_size (MATE_PANEL_APPLET (applet)); switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (applet))) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: priv->orient = GTK_ORIENTATION_VERTICAL; break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: priv->orient = GTK_ORIENTATION_HORIZONTAL; break; } priv->icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "accessories-dictionary", 48, 0, NULL); /* force first draw */ gdict_applet_draw (applet); /* force retrieval of the configuration from settings */ gdict_applet_set_source_name (applet, NULL); gdict_applet_set_defbox_font (applet, NULL); gdict_applet_set_print_font (applet, NULL); }
static gboolean charpicker_applet_fill (MatePanelApplet *applet) { MatePanelAppletOrient orientation; charpick_data *curr_data; GdkAtom utf8_atom; GList *list; gchar *string; GtkActionGroup *action_group; gchar *ui_path; g_set_application_name (_("Character Palette")); gtk_window_set_default_icon_name ("accessories-character-map"); mate_panel_applet_set_background_widget (applet, GTK_WIDGET (applet)); mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR); curr_data = g_new0 (charpick_data, 1); curr_data->last_index = NO_LAST_INDEX; curr_data->applet = GTK_WIDGET (applet); curr_data->about_dialog = NULL; curr_data->add_edit_dialog = NULL; curr_data->settings = mate_panel_applet_settings_new (applet, "org.mate.panel.applet.charpick"); get_chartable (curr_data); string = g_settings_get_string (curr_data->settings, "current-list"); if (string) { list = curr_data->chartable; while (list) { if (g_ascii_strcasecmp (list->data, string) == 0) curr_data->charlist = list->data; list = g_list_next (list); } /* FIXME: yeah leak, but this code is full of leaks and evil point shuffling. This should really be rewritten -George */ if (curr_data->charlist == NULL) curr_data->charlist = string; else g_free (string); } else { curr_data->charlist = curr_data->chartable->data; } curr_data->panel_size = mate_panel_applet_get_size (applet); orientation = mate_panel_applet_get_orient (applet); curr_data->panel_vertical = (orientation == MATE_PANEL_APPLET_ORIENT_LEFT) || (orientation == MATE_PANEL_APPLET_ORIENT_RIGHT); build_table (curr_data); g_signal_connect (G_OBJECT (curr_data->applet), "key_press_event", G_CALLBACK (key_press_event), curr_data); utf8_atom = gdk_atom_intern ("UTF8_STRING", FALSE); gtk_selection_add_target (curr_data->applet, GDK_SELECTION_PRIMARY, utf8_atom, 0); gtk_selection_add_target (curr_data->applet, GDK_SELECTION_CLIPBOARD, utf8_atom, 0); g_signal_connect (G_OBJECT (curr_data->applet), "selection_get", G_CALLBACK (charpick_selection_handler), curr_data); g_signal_connect (G_OBJECT (curr_data->applet), "selection_clear_event", G_CALLBACK (selection_clear_cb), curr_data); make_applet_accessible (GTK_WIDGET (applet)); /* session save signal */ g_signal_connect (G_OBJECT (applet), "change_orient", G_CALLBACK (applet_change_orient), curr_data); g_signal_connect (G_OBJECT (applet), "size_allocate", G_CALLBACK (applet_size_allocate), curr_data); g_signal_connect (G_OBJECT (applet), "destroy", G_CALLBACK (applet_destroy), curr_data); gtk_widget_show_all (GTK_WIDGET (applet)); action_group = gtk_action_group_new ("Charpicker Applet Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (action_group, charpick_applet_menu_actions, G_N_ELEMENTS (charpick_applet_menu_actions), curr_data); ui_path = g_build_filename (CHARPICK_MENU_UI_DIR, "charpick-applet-menu.xml", NULL); mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet), ui_path, action_group); g_free (ui_path); if (mate_panel_applet_get_locked_down (MATE_PANEL_APPLET (applet))) { GtkAction *action; action = gtk_action_group_get_action (action_group, "Preferences"); gtk_action_set_visible (action, FALSE); } g_object_unref (action_group); register_stock_for_edit (); populate_menu (curr_data); return TRUE; }
gboolean show_desktop_applet_fill(MatePanelApplet* applet) { ShowDesktopData* sdd; GtkActionGroup* action_group; AtkObject* atk_obj; GtkCssProvider *provider; mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR); sdd = g_new0(ShowDesktopData, 1); sdd->applet = GTK_WIDGET(applet); sdd->image = gtk_image_new(); switch (mate_panel_applet_get_orient(applet)) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: sdd->orient = GTK_ORIENTATION_VERTICAL; break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: default: sdd->orient = GTK_ORIENTATION_HORIZONTAL; break; } sdd->size = mate_panel_applet_get_size(MATE_PANEL_APPLET(sdd->applet)); g_signal_connect(G_OBJECT(sdd->applet), "realize", G_CALLBACK(show_desktop_applet_realized), sdd); sdd->button = gtk_toggle_button_new (); gtk_widget_set_name (sdd->button, "showdesktop-button"); provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, "#showdesktop-button {\n" "border-width: 0px; \n" /*a border here causes GTK warnings */ " padding: 0px;\n" " margin: 0px; }", -1, NULL); gtk_style_context_add_provider (gtk_widget_get_style_context (sdd->button), GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); atk_obj = gtk_widget_get_accessible(sdd->button); atk_object_set_name (atk_obj, _("Show Desktop Button")); g_signal_connect(G_OBJECT(sdd->button), "button_press_event", G_CALLBACK(do_not_eat_button_press), NULL); g_signal_connect(G_OBJECT(sdd->button), "toggled", G_CALLBACK(button_toggled_callback), sdd); gtk_container_set_border_width(GTK_CONTAINER(sdd->button), 0); gtk_container_add(GTK_CONTAINER(sdd->button), sdd->image); gtk_container_add(GTK_CONTAINER(sdd->applet), sdd->button); g_signal_connect (G_OBJECT(sdd->button), "size_allocate", G_CALLBACK(button_size_allocated), sdd); /* FIXME: Update this comment. */ /* we have to bind change_orient before we do applet_widget_add since we need to get an initial change_orient signal to set our initial oriantation, and we get that during the _add call */ g_signal_connect(G_OBJECT (sdd->applet), "change_orient", G_CALLBACK (applet_change_orient), sdd); mate_panel_applet_set_background_widget(MATE_PANEL_APPLET (sdd->applet), GTK_WIDGET(sdd->applet)); action_group = gtk_action_group_new("ShowDesktop Applet Actions"); gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(action_group, show_desktop_menu_actions, G_N_ELEMENTS (show_desktop_menu_actions), sdd); mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (sdd->applet), WNCKLET_RESOURCE_PATH "showdesktop-menu.xml", action_group); g_object_unref(action_group); g_signal_connect(G_OBJECT(sdd->applet), "destroy", G_CALLBACK(applet_destroyed), sdd); gtk_drag_dest_set(GTK_WIDGET(sdd->button), 0, NULL, 0, 0); g_signal_connect(G_OBJECT(sdd->button), "drag_motion", G_CALLBACK (button_drag_motion), sdd); g_signal_connect(G_OBJECT(sdd->button), "drag_leave", G_CALLBACK (button_drag_leave), sdd); gtk_widget_show_all(sdd->applet); return TRUE; }
static gboolean cw_applet_fill (MatePanelApplet *applet, const gchar *iid, gpointer data) { WinPickerApp *app; GtkWidget *eb, *tasks, *title; gchar *ui_path; GtkActionGroup *action_group; GObjectClass *object_class; if (strcmp (iid, "MateWindowPicker") != 0) return FALSE; bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); /* Have our background automatically painted. */ mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (applet), GTK_WIDGET (applet)); wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER); app = g_slice_new0 (WinPickerApp); mainapp = app; object_class = G_OBJECT_GET_CLASS (G_OBJECT(applet)); object_class->finalize = cw_applet_finalize; parent_class = g_type_class_peek_parent (object_class); /* gsettings prefs */ app->settings = mate_panel_applet_settings_new (applet, APPLET_SCHEMA); g_signal_connect (app->settings, "changed::" SHOW_WIN_KEY, G_CALLBACK (on_show_all_windows_changed), app); g_signal_connect (app->settings, "changed::" SHOW_HOME_TITLE_KEY, G_CALLBACK (on_show_home_title_changed), app); g_signal_connect (app->settings, "changed::" BOLD_WINDOW_TITLE_KEY, G_CALLBACK (on_bold_window_title_changed), app); app->applet = GTK_WIDGET (applet); force_no_focus_padding (GTK_WIDGET (applet)); gtk_container_set_border_width (GTK_CONTAINER (applet), 0); eb = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (applet), eb); gtk_container_set_border_width (GTK_CONTAINER (eb), 0); tasks = app->tasks = task_list_get_default (); gtk_box_pack_start (GTK_BOX (eb), tasks, FALSE, FALSE, 0); title = app->title = task_title_new (); gtk_box_pack_start (GTK_BOX (eb), title, TRUE, TRUE, 0); gtk_widget_show_all (GTK_WIDGET (applet)); on_show_all_windows_changed (app->settings, SHOW_WIN_KEY, app); on_show_home_title_changed (app->settings, SHOW_HOME_TITLE_KEY, app); on_bold_window_title_changed (app->settings, BOLD_WINDOW_TITLE_KEY, app); action_group = gtk_action_group_new ("MateWindowPicker Applet Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (action_group, window_picker_menu_actions, G_N_ELEMENTS (window_picker_menu_actions), app); ui_path = g_build_filename (MATEWINDOWPICKER_MENU_UI_DIR, "mate-window-picker-applet-menu.xml", NULL); mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (app->applet), ui_path, action_group); g_free (ui_path); g_object_unref (action_group); mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_EXPAND_MAJOR | MATE_PANEL_APPLET_EXPAND_MINOR | MATE_PANEL_APPLET_HAS_HANDLE); return TRUE; }
gboolean show_desktop_applet_fill(MatePanelApplet* applet) { ShowDesktopData* sdd; GtkActionGroup* action_group; gchar* ui_path; AtkObject* atk_obj; mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR); sdd = g_new0(ShowDesktopData, 1); sdd->applet = GTK_WIDGET(applet); sdd->image = gtk_image_new(); switch (mate_panel_applet_get_orient(applet)) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: sdd->orient = GTK_ORIENTATION_VERTICAL; break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: default: sdd->orient = GTK_ORIENTATION_HORIZONTAL; break; } sdd->size = mate_panel_applet_get_size(MATE_PANEL_APPLET(sdd->applet)); g_signal_connect(G_OBJECT(sdd->applet), "realize", G_CALLBACK(show_desktop_applet_realized), sdd); sdd->button = gtk_toggle_button_new (); gtk_widget_set_name (sdd->button, "showdesktop-button"); gtk_rc_parse_string ("\n" " style \"showdesktop-button-style\"\n" " {\n" " GtkWidget::focus-line-width=0\n" " GtkWidget::focus-padding=0\n" " }\n" "\n" " widget \"*.showdesktop-button\" style \"showdesktop-button-style\"\n" "\n"); atk_obj = gtk_widget_get_accessible(sdd->button); atk_object_set_name (atk_obj, _("Show Desktop Button")); g_signal_connect(G_OBJECT(sdd->button), "button_press_event", G_CALLBACK(do_not_eat_button_press), NULL); g_signal_connect(G_OBJECT(sdd->button), "toggled", G_CALLBACK(button_toggled_callback), sdd); gtk_container_set_border_width(GTK_CONTAINER(sdd->button), 0); gtk_container_add(GTK_CONTAINER(sdd->button), sdd->image); gtk_container_add(GTK_CONTAINER(sdd->applet), sdd->button); g_signal_connect (G_OBJECT(sdd->button), "size_allocate", G_CALLBACK(button_size_allocated), sdd); /* FIXME: Update this comment. */ /* we have to bind change_orient before we do applet_widget_add since we need to get an initial change_orient signal to set our initial oriantation, and we get that during the _add call */ g_signal_connect(G_OBJECT (sdd->applet), "change_orient", G_CALLBACK (applet_change_orient), sdd); mate_panel_applet_set_background_widget(MATE_PANEL_APPLET (sdd->applet), GTK_WIDGET(sdd->applet)); action_group = gtk_action_group_new("ShowDesktop Applet Actions"); gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(action_group, show_desktop_menu_actions, G_N_ELEMENTS (show_desktop_menu_actions), sdd); ui_path = g_build_filename(WNCK_MENU_UI_DIR, "showdesktop-menu.xml", NULL); mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(sdd->applet), ui_path, action_group); g_free(ui_path); g_object_unref(action_group); g_signal_connect(G_OBJECT(sdd->applet), "destroy", G_CALLBACK(applet_destroyed), sdd); gtk_drag_dest_set(GTK_WIDGET(sdd->button), 0, NULL, 0, 0); g_signal_connect(G_OBJECT(sdd->button), "drag_motion", G_CALLBACK (button_drag_motion), sdd); g_signal_connect(G_OBJECT(sdd->button), "drag_leave", G_CALLBACK (button_drag_leave), sdd); gtk_widget_show_all(sdd->applet); return TRUE; }
/* create a box and stuff the load graphs inside of it */ static gboolean multiload_applet_new(MatePanelApplet *applet, const gchar *iid, gpointer data) { GtkStyleContext *context; MultiloadApplet *ma; GSettings *lockdown_settings; GtkActionGroup *action_group; gchar *ui_path; context = gtk_widget_get_style_context (GTK_WIDGET (applet)); gtk_style_context_add_class (context, "multiload-applet"); ma = g_new0(MultiloadApplet, 1); ma->applet = applet; ma->about_dialog = NULL; ma->prop_dialog = NULL; ma->last_clicked = 0; g_set_application_name (_("System Monitor")); gtk_window_set_default_icon_name ("utilities-system-monitor"); mate_panel_applet_set_background_widget (applet, GTK_WIDGET(applet)); ma->settings = mate_panel_applet_settings_new (applet, "org.mate.panel.applet.multiload"); mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR); action_group = gtk_action_group_new ("Multiload Applet Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (action_group, multiload_menu_actions, G_N_ELEMENTS (multiload_menu_actions), ma); ui_path = g_build_filename (MULTILOAD_MENU_UI_DIR, "multiload-applet-menu.xml", NULL); mate_panel_applet_setup_menu_from_file (applet, ui_path, action_group); g_free (ui_path); if (mate_panel_applet_get_locked_down (applet)) { GtkAction *action; action = gtk_action_group_get_action (action_group, "MultiLoadProperties"); gtk_action_set_visible (action, FALSE); } lockdown_settings = g_settings_new ("org.mate.lockdown"); if (g_settings_get_boolean (lockdown_settings, "disable-command-line") || mate_panel_applet_get_locked_down (applet)) { GtkAction *action; /* When the panel is locked down or when the command line is inhibited, it seems very likely that running the procman would be at least harmful */ action = gtk_action_group_get_action (action_group, "MultiLoadRunProcman"); gtk_action_set_visible (action, FALSE); } g_object_unref (lockdown_settings); g_object_unref (action_group); g_signal_connect(G_OBJECT(applet), "change_size", G_CALLBACK(multiload_change_size_cb), ma); g_signal_connect(G_OBJECT(applet), "change_orient", G_CALLBACK(multiload_change_orient_cb), ma); g_signal_connect(G_OBJECT(applet), "destroy", G_CALLBACK(multiload_destroy_cb), ma); g_signal_connect(G_OBJECT(applet), "button_press_event", G_CALLBACK(multiload_button_press_event_cb), ma); g_signal_connect(G_OBJECT(applet), "key_press_event", G_CALLBACK(multiload_key_press_event_cb), ma); multiload_applet_refresh (ma); gtk_widget_show(GTK_WIDGET(applet)); return TRUE; }
gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) { PagerData* pager; GtkActionGroup* action_group; gchar* ui_path; GError* error; gboolean display_names; mate_panel_applet_add_preferences(applet, "/schemas/apps/workspace_switcher_applet/prefs", NULL); pager = g_new0(PagerData, 1); pager->applet = GTK_WIDGET(applet); mate_panel_applet_set_flags(MATE_PANEL_APPLET(pager->applet), MATE_PANEL_APPLET_EXPAND_MINOR); setup_mateconf(pager); error = NULL; pager->n_rows = mate_panel_applet_mateconf_get_int(applet, "num_rows", &error); if (error) { g_printerr(_("Error loading num_rows value for Workspace Switcher: %s\n"), error->message); g_error_free(error); /* leave current value */ } pager->n_rows = CLAMP(pager->n_rows, 1, MAX_REASONABLE_ROWS); error = NULL; display_names = mate_panel_applet_mateconf_get_bool(applet, "display_workspace_names", &error); if (error) { g_printerr(_("Error loading display_workspace_names value for Workspace Switcher: %s\n"), error->message); g_error_free(error); /* leave current value */ } if (display_names) { pager->display_mode = MATEWNCK_PAGER_DISPLAY_NAME; } else { pager->display_mode = MATEWNCK_PAGER_DISPLAY_CONTENT; } error = NULL; pager->display_all = mate_panel_applet_mateconf_get_bool(applet, "display_all_workspaces", &error); if (error) { g_printerr(_("Error loading display_all_workspaces value for Workspace Switcher: %s\n"), error->message); g_error_free(error); /* leave current value */ } switch (mate_panel_applet_get_orient(applet)) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: pager->orientation = GTK_ORIENTATION_VERTICAL; break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: default: pager->orientation = GTK_ORIENTATION_HORIZONTAL; break; } pager->pager = matewnck_pager_new(NULL); pager->screen = NULL; pager->wm = PAGER_WM_UNKNOWN; matewnck_pager_set_shadow_type(MATEWNCK_PAGER(pager->pager), GTK_SHADOW_IN); g_signal_connect(G_OBJECT(pager->pager), "destroy", G_CALLBACK(destroy_pager), pager); gtk_container_add(GTK_CONTAINER(pager->applet), pager->pager); gtk_widget_show(pager->pager); g_signal_connect(G_OBJECT(pager->applet), "realize", G_CALLBACK(applet_realized), pager); g_signal_connect(G_OBJECT(pager->applet), "unrealize", G_CALLBACK(applet_unrealized), pager); g_signal_connect(G_OBJECT(pager->applet), "change_orient", G_CALLBACK(applet_change_orient), pager); g_signal_connect(G_OBJECT(pager->applet), "scroll-event", G_CALLBACK(applet_scroll), pager); g_signal_connect(G_OBJECT(pager->applet), "change_background", G_CALLBACK(applet_change_background), pager); gtk_widget_show(pager->applet); mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(pager->applet), GTK_WIDGET(pager->applet)); action_group = gtk_action_group_new("WorkspaceSwitcher Applet Actions"); gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(action_group, pager_menu_actions, G_N_ELEMENTS(pager_menu_actions), pager); ui_path = g_build_filename(WNCK_MENU_UI_DIR, "workspace-switcher-menu.xml", NULL); mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(pager->applet), ui_path, action_group); g_free(ui_path); if (mate_panel_applet_get_locked_down(MATE_PANEL_APPLET(pager->applet))) { GtkAction *action; action = gtk_action_group_get_action(action_group, "PagerPreferences"); gtk_action_set_visible(action, FALSE); } g_object_unref(action_group); return TRUE; }
static AccessxStatusApplet* create_applet(MatePanelApplet* applet) { AccessxStatusApplet* sapplet = g_new0(AccessxStatusApplet, 1); GtkWidget* box; GtkWidget* stickyfoo; AtkObject* atko; GdkPixbuf* pixbuf; gint large_toolbar_pixels; g_set_application_name(_("AccessX Status")); sapplet->xkb = NULL; sapplet->xkb_display = NULL; sapplet->box = NULL; sapplet->initialized = False; /* there must be a better way */ sapplet->error_type = ACCESSX_STATUS_ERROR_NONE; sapplet->applet = applet; mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR); sapplet->orient = mate_panel_applet_get_orient(applet); if (sapplet->orient == MATE_PANEL_APPLET_ORIENT_LEFT || sapplet->orient == MATE_PANEL_APPLET_ORIENT_RIGHT) { box = gtk_vbox_new(FALSE, 0); stickyfoo = gtk_vbox_new(TRUE, 0); } else { box = gtk_hbox_new(FALSE, 0); stickyfoo = gtk_hbox_new(TRUE, 0); } #if GTK_CHECK_VERSION (3, 0, 0) gtk_box_set_homogeneous (GTK_BOX (stickyfoo), TRUE); #endif large_toolbar_pixels = 24; /* FIXME */ if (mate_panel_applet_get_size(sapplet->applet) >= large_toolbar_pixels) { icon_size_spec = GTK_ICON_SIZE_LARGE_TOOLBAR; } else { icon_size_spec = GTK_ICON_SIZE_SMALL_TOOLBAR; } accessx_applet_add_stock_icons(sapplet, box); pixbuf = accessx_status_applet_mousekeys_image(sapplet, NULL); sapplet->mousefoo = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); gtk_widget_hide(sapplet->mousefoo); sapplet->shift_indicator = gtk_image_new_from_stock(SHIFT_KEY_ICON, icon_size_spec); gtk_widget_hide(sapplet->mousefoo); sapplet->ctrl_indicator = gtk_image_new_from_stock(CONTROL_KEY_ICON, icon_size_spec); sapplet->alt_indicator = gtk_image_new_from_stock(ALT_KEY_ICON, icon_size_spec); sapplet->meta_indicator = gtk_image_new_from_stock(META_KEY_ICON, icon_size_spec); gtk_widget_set_sensitive(sapplet->meta_indicator, FALSE); gtk_widget_hide(sapplet->meta_indicator); sapplet->hyper_indicator = gtk_image_new_from_stock(HYPER_KEY_ICON, icon_size_spec); gtk_widget_set_sensitive(sapplet->hyper_indicator, FALSE); gtk_widget_hide(sapplet->hyper_indicator); sapplet->super_indicator = gtk_image_new_from_stock(SUPER_KEY_ICON, icon_size_spec); gtk_widget_set_sensitive(sapplet->super_indicator, FALSE); gtk_widget_hide(sapplet->super_indicator); sapplet->alt_graph_indicator = gtk_image_new_from_stock(ALTGRAPH_KEY_ICON, icon_size_spec); gtk_widget_set_sensitive(sapplet->alt_graph_indicator, FALSE); pixbuf = accessx_status_applet_slowkeys_image(sapplet, NULL); sapplet->slowfoo = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); gtk_widget_hide(sapplet->slowfoo); pixbuf = accessx_status_applet_bouncekeys_image(sapplet, NULL); sapplet->bouncefoo = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(pixbuf); gtk_widget_hide(sapplet->bouncefoo); sapplet->idlefoo = gtk_image_new_from_stock(ACCESSX_APPLET, icon_size_spec); gtk_widget_show(sapplet->slowfoo); accessx_status_applet_layout_box(sapplet, box, stickyfoo); atko = gtk_widget_get_accessible(GTK_WIDGET(sapplet->applet)); atk_object_set_name(atko, _("AccessX Status")); atk_object_set_description(atko, _("Shows keyboard status when accessibility features are used.")); return sapplet; }
gboolean workspace_switcher_applet_fill(MatePanelApplet* applet) { PagerData* pager; GtkActionGroup* action_group; gchar* ui_path; gboolean display_names; #if GTK_CHECK_VERSION (3, 0, 0) GtkCssProvider *provider; #endif pager = g_new0(PagerData, 1); pager->applet = GTK_WIDGET(applet); mate_panel_applet_set_flags(MATE_PANEL_APPLET(pager->applet), MATE_PANEL_APPLET_EXPAND_MINOR); setup_gsettings(pager); pager->n_rows = g_settings_get_int(pager->settings, "num-rows"); pager->n_rows = CLAMP(pager->n_rows, 1, MAX_REASONABLE_ROWS); display_names = g_settings_get_boolean(pager->settings, "display-workspace-names"); pager->wrap_workspaces = g_settings_get_boolean(pager->settings, "wrap-workspaces"); if (display_names) { pager->display_mode = WNCK_PAGER_DISPLAY_NAME; } else { pager->display_mode = WNCK_PAGER_DISPLAY_CONTENT; } pager->display_all = g_settings_get_boolean(pager->settings, "display-all-workspaces"); switch (mate_panel_applet_get_orient(applet)) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: pager->orientation = GTK_ORIENTATION_VERTICAL; break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: default: pager->orientation = GTK_ORIENTATION_HORIZONTAL; break; } #ifdef WNCK_CHECK_VERSION #if WNCK_CHECK_VERSION (3, 0, 0) pager->pager = wnck_pager_new(); #else pager->pager = wnck_pager_new(NULL); #endif #else pager->pager = wnck_pager_new(NULL); #endif pager->screen = NULL; pager->wm = PAGER_WM_UNKNOWN; wnck_pager_set_shadow_type(WNCK_PAGER(pager->pager), GTK_SHADOW_IN); #if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (applet)); gtk_style_context_add_class (context, "wnck-applet"); context = gtk_widget_get_style_context (pager->pager); gtk_style_context_add_class (context, "wnck-pager"); provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, ".wnck-pager:selected {\n" "background-color: #4A90D9; }", -1, NULL); gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_FALLBACK); g_object_unref (provider); #endif g_signal_connect(G_OBJECT(pager->pager), "destroy", G_CALLBACK(destroy_pager), pager); gtk_container_add(GTK_CONTAINER(pager->applet), pager->pager); gtk_widget_show(pager->pager); g_signal_connect(G_OBJECT(pager->applet), "realize", G_CALLBACK(applet_realized), pager); g_signal_connect(G_OBJECT(pager->applet), "unrealize", G_CALLBACK(applet_unrealized), pager); g_signal_connect(G_OBJECT(pager->applet), "change_orient", G_CALLBACK(applet_change_orient), pager); #if !GTK_CHECK_VERSION (3, 0, 0) g_signal_connect(G_OBJECT(pager->applet), "scroll-event", G_CALLBACK(applet_scroll), pager); #endif g_signal_connect(G_OBJECT(pager->applet), "change_background", G_CALLBACK(applet_change_background), pager); gtk_widget_show(pager->applet); mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(pager->applet), GTK_WIDGET(pager->applet)); action_group = gtk_action_group_new("WorkspaceSwitcher Applet Actions"); gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(action_group, pager_menu_actions, G_N_ELEMENTS(pager_menu_actions), pager); ui_path = g_build_filename(WNCK_MENU_UI_DIR, "workspace-switcher-menu.xml", NULL); mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(pager->applet), ui_path, action_group); g_free(ui_path); if (mate_panel_applet_get_locked_down(MATE_PANEL_APPLET(pager->applet))) { GtkAction *action; action = gtk_action_group_get_action(action_group, "PagerPreferences"); gtk_action_set_visible(action, FALSE); } g_object_unref(action_group); return TRUE; }