Exemplo n.º 1
0
static TimeOutPlugin*
time_out_new (XfcePanelPlugin *plugin)
{
  TimeOutPlugin *time_out;
  GtkOrientation orientation;

  /* Allocate memory for the plugin structure */
  time_out = panel_slice_new0 (TimeOutPlugin);

  /* Store pointer to the plugin */
  time_out->plugin = plugin;

  /* Create lock screen */
  time_out->lock_screen = time_out_lock_screen_new ();

  /* Connect to 'postpone' signal of the lock screen */
  g_signal_connect (G_OBJECT (time_out->lock_screen), "postpone", G_CALLBACK (time_out_postpone), time_out);

  /* Connect to 'resume' signal of the lock screen */
  g_signal_connect (G_OBJECT (time_out->lock_screen), "resume", G_CALLBACK (time_out_resume), time_out);

  /* Create countdowns */
  time_out->break_countdown = time_out_countdown_new ();
  time_out->lock_countdown = time_out_countdown_new ();

  /* Connect to break countdown signals */
  g_signal_connect (G_OBJECT (time_out->break_countdown), "update", G_CALLBACK (time_out_break_countdown_update), time_out);
  g_signal_connect (G_OBJECT (time_out->break_countdown), "finish", G_CALLBACK (time_out_break_countdown_finish), time_out);

  /* Connect to lock countdown signals */
  g_signal_connect (G_OBJECT (time_out->lock_countdown), "update", G_CALLBACK (time_out_lock_countdown_update), time_out);
  g_signal_connect (G_OBJECT (time_out->lock_countdown), "finish", G_CALLBACK (time_out_lock_countdown_finish), time_out);

  /* Get the current orientation */
  orientation = xfce_panel_plugin_get_orientation (plugin);

  /* Create event box to catch user events */
  time_out->ebox = gtk_event_box_new ();
  gtk_event_box_set_visible_window(GTK_EVENT_BOX(time_out->ebox), FALSE);
  gtk_widget_show (time_out->ebox);

  /* Create flexible box which can do both, horizontal and vertical layout */
  time_out->hvbox = xfce_hvbox_new (orientation, FALSE, 2);
  gtk_container_add (GTK_CONTAINER (time_out->ebox), time_out->hvbox);
  gtk_widget_show (time_out->hvbox);

  /* Create time out icon */
  time_out->panel_icon = gtk_image_new_from_icon_name ("xfce4-time-out-plugin", GTK_ICON_SIZE_DIALOG);
  gtk_image_set_pixel_size (GTK_IMAGE (time_out->panel_icon), xfce_panel_plugin_get_size (time_out->plugin) - 8);
  gtk_box_pack_start (GTK_BOX (time_out->hvbox), time_out->panel_icon, TRUE, TRUE, 0);
  gtk_widget_show (time_out->panel_icon);

  /* Create label for displaying the remaining time until the next break */
  time_out->time_label = gtk_label_new (_("Inactive"));
  gtk_misc_set_alignment (GTK_MISC (time_out->time_label), 0.5, 0.5);
  gtk_box_pack_start (GTK_BOX (time_out->hvbox), time_out->time_label, TRUE, TRUE, 0);
  gtk_widget_show (time_out->time_label);

  return time_out;
}
Exemplo n.º 2
0
t_quicklauncher *
quicklauncher_new (XfcePanelPlugin *plugin)
{
	t_quicklauncher *quicklauncher;
	gchar *filename;
	
	DBG ("create quicklauncher");
	quicklauncher = g_new0(t_quicklauncher, 1);
	filename = xfce_panel_plugin_save_location(plugin, TRUE);
	quicklauncher->icon_size = (gint) (0.75 * xfce_panel_plugin_get_size(plugin)/2);
	DBG ("icon size: %d", quicklauncher->icon_size);
	if((!filename) || (!quicklauncher_load_config(quicklauncher, filename) ) )
		quicklauncher_load_default(quicklauncher);

	quicklauncher->orientation = xfce_panel_plugin_get_orientation(plugin);
	quicklauncher->plugin = plugin;
	quicklauncher->table = g_object_ref(gtk_table_new(2, 2, TRUE));
	gtk_table_set_col_spacings(GTK_TABLE(quicklauncher->table), 0);
	gtk_container_add( GTK_CONTAINER(quicklauncher->plugin), quicklauncher->table);
	xfce_panel_plugin_add_action_widget(quicklauncher->plugin, quicklauncher->table);
	gtk_widget_show(quicklauncher->table);

	quicklauncher_organize(quicklauncher);
	return quicklauncher;
}
Exemplo n.º 3
0
static Bubblemon *
create_gui (XfcePanelPlugin *plugin)
{
  GtkWidget *frame, *ebox;
  GtkOrientation orientation;
  Bubblemon *base = g_new0(Bubblemon, 1);

  orientation = xfce_panel_plugin_get_orientation(plugin);
  base->plugin=plugin;

  base->bubblemon=bubblemon_init();
  bubblemon_plugin_fill(base, plugin);

  ebox = gtk_event_box_new();
  gtk_container_add( GTK_CONTAINER( plugin ), ebox );

  base->box = xfce_hvbox_new(orientation, FALSE, 0);
  gtk_container_add(GTK_CONTAINER(ebox), base->box);

  base->frame_widget = frame = gtk_frame_new( NULL );
  gtk_box_pack_end( GTK_BOX(base->box), frame, TRUE, TRUE, 0);

  gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( base->draw_area ) );

  update_orientation(plugin, orientation, base);
  gtk_widget_show_all(ebox);

  return base;
}
Exemplo n.º 4
0
static gboolean
time_out_size_changed (XfcePanelPlugin *plugin,
                       gint             size,
                       TimeOutPlugin   *time_out)
{
  GtkOrientation orientation;

  g_return_val_if_fail (plugin != NULL, FALSE);
  g_return_val_if_fail (time_out != NULL, FALSE);

  /* Get the orientation of the panel */
  orientation = xfce_panel_plugin_get_orientation (plugin);

  /* Update icon size */
  gtk_image_set_pixel_size (GTK_IMAGE (time_out->panel_icon), size - 8);

  /* Update widget size */
  if (orientation == GTK_ORIENTATION_HORIZONTAL)
    gtk_widget_set_size_request (GTK_WIDGET (plugin), -1, size);
  else
    gtk_widget_set_size_request (GTK_WIDGET (plugin), size, -1);

  /* We handled the orientation */
  return TRUE;
}
Exemplo n.º 5
0
static WindowckPlugin * windowck_new(XfcePanelPlugin *plugin)
{
    WindowckPlugin *wckp;

    GtkOrientation orientation;
    GtkWidget *label;

    /* allocate memory for the plugin structure */
    wckp = g_slice_new0 (WindowckPlugin);

    /* pointer to plugin */
    wckp->plugin = plugin;

    /* read the user settings */
    windowck_read(wckp);

    /* get the current orientation */
    orientation = xfce_panel_plugin_get_orientation(plugin);

    /* not needed for shrink mode */
    if (!wckp->prefs->size_mode == SHRINK)
        xfce_panel_plugin_set_shrink (plugin, TRUE);

    /* create some panel widgets */
    wckp->ebox = gtk_event_box_new();
    gtk_event_box_set_visible_window(GTK_EVENT_BOX(wckp->ebox), FALSE);
    gtk_widget_set_name(wckp->ebox, "XfceWindowckPlugin");

    wckp->alignment = gtk_alignment_new (0.5, 0.5, 0, 0);

    wckp->hvbox = xfce_hvbox_new(orientation, FALSE, 2);

    /* some wckp widgets */
    label = gtk_label_new("");
    wckp->title = GTK_LABEL (label);

    create_icon (wckp);

    gtk_box_pack_start (GTK_BOX(wckp->hvbox), label, TRUE, TRUE, 0);

    if (wckp->prefs->icon_on_right)
    {
        gtk_box_reorder_child (GTK_BOX (wckp->hvbox), GTK_WIDGET(wckp->icon->eventbox), 1);
    }

    gtk_container_add(GTK_CONTAINER(wckp->alignment), GTK_WIDGET(wckp->hvbox));
    gtk_container_add(GTK_CONTAINER(wckp->ebox), wckp->alignment);

    /* show widgets */
    gtk_widget_show(wckp->ebox);
    gtk_widget_show(wckp->alignment);
    gtk_widget_show(wckp->hvbox);
    gtk_widget_show(label);

    return wckp;
}
Exemplo n.º 6
0
static gboolean
plugin_reconfigure (XfcePanelPlugin *plugin, guint size, Bubblemon *base)
{
  int width = base->width;
  int height = base->height;

  GtkOrientation orientation =
	  xfce_panel_plugin_get_orientation(base->plugin);

  if (orientation != GTK_ORIENTATION_HORIZONTAL)
  {
    width=size;
    // We're on a vertical panel, height is decided based on the width
    if (width <= RELATIVE_WIDTH) {
      height = RELATIVE_HEIGHT;
    } else {
      height = (width * RELATIVE_HEIGHT) / RELATIVE_WIDTH;
    }
  } else {
    height=size;
    // We're on a horizontal panel, width is decided based on the height
    if (height <= RELATIVE_HEIGHT) {
      width = RELATIVE_WIDTH;
    } else {
      width = (height * RELATIVE_WIDTH) / RELATIVE_HEIGHT;
    }
  }

  if (base->width == width
      && base->height == height)
  {
    // Already at the correct size, done!
    return TRUE;
  }

  gtk_widget_set_size_request(GTK_WIDGET(base->draw_area), width, height);

  base->width = width;
  base->height = height;

  if (base->plugin == NULL) {
    // Not yet all loaded up
    return TRUE;
  }

  base->rgb_buffer = g_realloc(base->rgb_buffer, width * height * 3);
  bubblemon_setSize(base->bubblemon, width, height);

  ui_update(base);

  return TRUE;
}
static void fortune_fish_plugin_adjust(fortune_fish_plugin *fish_plugin) {

    fish_plugin->fish->orientation = xfce_panel_plugin_get_orientation(fish_plugin->plugin);
    fish_plugin->fish->size = xfce_panel_plugin_get_size(fish_plugin->plugin);

    if (fish_plugin->fish->orientation == GTK_ORIENTATION_HORIZONTAL) {
        gtk_widget_set_size_request(GTK_WIDGET(fish_plugin->plugin),
                -1, fish_plugin->fish->size);
    } else {
        gtk_widget_set_size_request(GTK_WIDGET(fish_plugin->plugin),
                fish_plugin->fish->size, -1);
    }
}
Exemplo n.º 8
0
static void
places_button_resize(PlacesButton *self)
{
    gboolean show_label;
    gint new_size;
    gboolean vertical = FALSE;
#ifdef HAS_PANEL_49
    gboolean deskbar = FALSE;
#endif
    gint nrows = 1;

    if (self->plugin == NULL)
        return;

    new_size = xfce_panel_plugin_get_size(self->plugin);
    self->plugin_size = new_size;
    DBG("Panel size: %d", new_size);

    show_label = self->label_text != NULL;

#ifdef HAS_PANEL_49
  if (xfce_panel_plugin_get_mode(self->plugin) == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
    deskbar = TRUE;
  else if (xfce_panel_plugin_get_mode(self->plugin) == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
    vertical = TRUE;
  nrows = xfce_panel_plugin_get_nrows(self->plugin);
#else
  if (xfce_panel_plugin_get_orientation(self->plugin) == GTK_ORIENTATION_VERTICAL)
    vertical = TRUE;
#endif

    new_size /= nrows;

    if (show_label) {
#ifdef HAS_PANEL_49
        xfce_panel_plugin_set_small (self->plugin, deskbar ? FALSE : TRUE);
#endif
        if (vertical)
          gtk_alignment_set (GTK_ALIGNMENT (self->alignment), 0.5, 0.0, 0.0, 1.0);
        else
          gtk_alignment_set (GTK_ALIGNMENT (self->alignment), 0.0, 0.5, 1.0, 0.0);
    } else {
#ifdef HAS_PANEL_49
        xfce_panel_plugin_set_small(self->plugin, TRUE);
#endif
        gtk_alignment_set (GTK_ALIGNMENT (self->alignment), 0.5, 0.5, 1.0, 1.0);
    }

    /* label */
    places_button_resize_label(self, show_label);
}
Exemplo n.º 9
0
static void
places_button_resize_label(PlacesButton *self,
                           gboolean      show)
{
  gboolean vertical = FALSE;
  gboolean deskbar = FALSE;

#ifdef HAS_PANEL_49
  if (xfce_panel_plugin_get_mode(self->plugin) == XFCE_PANEL_PLUGIN_MODE_DESKBAR)
    deskbar = TRUE;
  else if (xfce_panel_plugin_get_mode(self->plugin) == XFCE_PANEL_PLUGIN_MODE_VERTICAL)
    vertical = TRUE;
#else
  if (xfce_panel_plugin_get_orientation(self->plugin) == GTK_ORIENTATION_VERTICAL)
    vertical = TRUE;
#endif

    if (self->label_text == NULL) {
        places_button_destroy_label(self);
        return;
    }

    if (self->label == NULL) {
        self->label = g_object_ref(gtk_label_new(self->label_text));
        gtk_box_pack_end(GTK_BOX(self->box), self->label, TRUE, TRUE, 0);
    }
    else
        gtk_label_set_text(GTK_LABEL(self->label), self->label_text);

    if (deskbar || self->ellipsize)
      gtk_label_set_ellipsize (GTK_LABEL (self->label), PANGO_ELLIPSIZE_END);
    else
      gtk_label_set_ellipsize (GTK_LABEL (self->label), PANGO_ELLIPSIZE_NONE);

    if (vertical)
      {
        gtk_label_set_angle (GTK_LABEL (self->label), -90);
        gtk_misc_set_alignment (GTK_MISC (self->label), 0.5, 0.0);
      }
    else
      {
        gtk_label_set_angle (GTK_LABEL (self->label), 0);
        gtk_misc_set_alignment (GTK_MISC (self->label), 0.0, 0.5);
      }
    if(self->ellipsize)
       gtk_label_set_max_width_chars (GTK_LABEL (self->label), 25);
    else
       gtk_label_set_max_width_chars (GTK_LABEL (self->label), 255);

    gtk_widget_show(self->label);
}
/**
 * construct_workspaces:
 * @plugin: the xfce plugin object
 *
 * Create the plugin.
 *
 * Returns: the plugin
 */
static i3WorkspacesPlugin *
construct_workspaces(XfcePanelPlugin *plugin)
{
    i3WorkspacesPlugin *i3_workspaces;
    GtkOrientation orientation;

    /* allocate memory for the plugin structure */
    i3_workspaces = panel_slice_new0(i3WorkspacesPlugin);

    /* pointer to plugin */
    i3_workspaces->plugin = plugin;

    /* plugin configuration */
    i3_workspaces->config = i3_workspaces_config_new();
    i3_workspaces_config_load(i3_workspaces->config, plugin);

    /* get the current orientation */
    orientation = xfce_panel_plugin_get_orientation (plugin);

    /* create some panel widgets */
    i3_workspaces->ebox = gtk_event_box_new();
    gtk_widget_show(i3_workspaces->ebox);

    /* listen for scroll events */
    gtk_widget_add_events(i3_workspaces->ebox, GDK_SCROLL_MASK);
    g_signal_connect(G_OBJECT(i3_workspaces->ebox), "scroll-event",
            G_CALLBACK(on_workspace_scrolled), i3_workspaces);

    i3_workspaces->hvbox = xfce_hvbox_new(orientation, FALSE, 2);
    gtk_widget_show(i3_workspaces->hvbox);
    gtk_container_add(GTK_CONTAINER(i3_workspaces->ebox), i3_workspaces->hvbox);

    i3_workspaces->workspace_buttons = g_hash_table_new(g_direct_hash, g_direct_equal);

    GError *err = NULL;
    i3_workspaces->i3wm = i3wm_construct(&err);
    if (NULL != err)
    {
        //TODO: error_state_on();
        recover_from_disconnect(i3_workspaces);
        //TODO: error_state_off();
    }

    connect_callbacks(i3_workspaces);

    add_workspaces(i3_workspaces);

    return i3_workspaces;
}
Exemplo n.º 11
0
static void setup_size_option( GtkBox *vbox, GtkSizeGroup *sg, XfcePanelPlugin *plugin, CPUGraph *base )
{
	GtkBox *hbox;
	GtkWidget *Size;

	if( xfce_panel_plugin_get_orientation( plugin ) == GTK_ORIENTATION_HORIZONTAL )
		hbox = create_option_line( vbox, sg, _("Width:") );
	else
		hbox = create_option_line( vbox, sg, _("Height:") );

	Size = gtk_spin_button_new_with_range( 10, 128, 1 );
	gtk_spin_button_set_value( GTK_SPIN_BUTTON( Size ), base->size );
	gtk_widget_show( Size );
	gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( Size ), FALSE, FALSE, 0 );
	g_signal_connect( Size, "value-changed", G_CALLBACK( change_size ), base );
}
Exemplo n.º 12
0
static gboolean
lightdash_size_changed (XfcePanelPlugin *plugin,
                        gint size,
                        LightdashPlugin *lightdash)
{
    GtkOrientation orientation;

    orientation = xfce_panel_plugin_get_orientation (plugin);

    if (orientation == GTK_ORIENTATION_HORIZONTAL)
        gtk_widget_set_size_request (GTK_WIDGET (plugin), -1, size);
    else
        gtk_widget_set_size_request (GTK_WIDGET (plugin), size, -1);

    return TRUE;
}
Exemplo n.º 13
0
static gboolean 
xfapplet_size_changed (XfcePanelPlugin *plugin, int size, gpointer data)
{
	XfAppletPlugin	*xap = (XfAppletPlugin*) data;
	
	if (xap->configured) {
		gint sz = xfapplet_xfce_size_to_mate_size (size);
		matecomponent_pbclient_set_short (xap->prop_bag, "panel-applet-size", sz, NULL);
	}

	if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL)
		gtk_widget_set_size_request (GTK_WIDGET (plugin), -1, size);
	else
		gtk_widget_set_size_request (GTK_WIDGET (plugin), size, -1);

	return TRUE;
}
/**
 * size_changed:
 * @plugin: the xfce plugin
 * @size: the size
 * @i3_workspaces: the workspaces plugin
 *
 * Handle the plugin size change.
 *
 * Returns: gboolean
 */
static gboolean
size_changed(XfcePanelPlugin *plugin, gint size, i3WorkspacesPlugin *i3_workspaces)
{
    GtkOrientation orientation;

    /* get the orientation of the plugin */
    orientation = xfce_panel_plugin_get_orientation(plugin);

    /* set the widget size */
    if (orientation == GTK_ORIENTATION_HORIZONTAL)
        gtk_widget_set_size_request(GTK_WIDGET(plugin), -1, size);
    else
        gtk_widget_set_size_request(GTK_WIDGET(plugin), size, -1);

    /* we handled the orientation */
    return TRUE;
}
Exemplo n.º 15
0
static gboolean
eyes_set_size (XfcePanelPlugin *plugin, int size)
{
    if (xfce_panel_plugin_get_orientation (plugin) ==
            GTK_ORIENTATION_HORIZONTAL)
    {
        gtk_widget_set_size_request (GTK_WIDGET (plugin),
                                     -1, size);
    }
    else
    {
        gtk_widget_set_size_request (GTK_WIDGET (plugin),
                                     size, -1);
    }

    return TRUE;
}
Exemplo n.º 16
0
static void
places_button_construct(PlacesButton *self, XfcePanelPlugin *plugin)
{
    GtkOrientation orientation;

    g_assert(XFCE_IS_PANEL_PLUGIN(plugin));

    g_object_ref(plugin);
    self->plugin = plugin;

    /* from libxfce4panel */
    GTK_WIDGET_UNSET_FLAGS(self, GTK_CAN_DEFAULT|GTK_CAN_FOCUS);
    gtk_button_set_relief(GTK_BUTTON(self), GTK_RELIEF_NONE);
    gtk_button_set_focus_on_click(GTK_BUTTON(self), FALSE);

    self->alignment = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
    gtk_container_add(GTK_CONTAINER(self), self->alignment);
    gtk_widget_show(self->alignment);

    orientation = xfce_panel_plugin_get_orientation(self->plugin);
    self->box = xfce_hvbox_new(orientation, FALSE, BOX_SPACING);
    gtk_container_set_border_width(GTK_CONTAINER(self->box), 0);
    gtk_container_add(GTK_CONTAINER(self->alignment), self->box);
    gtk_widget_show(self->box);

    places_button_resize(self);

#ifdef HAS_PANEL_49
    g_signal_connect(G_OBJECT(plugin), "mode-changed",
                     G_CALLBACK(places_button_mode_changed), self);
#else
    g_signal_connect(G_OBJECT(plugin), "orientation-changed",
                     G_CALLBACK(places_button_orientation_changed), self);
#endif
    g_signal_connect(G_OBJECT(plugin), "size-changed",
                     G_CALLBACK(places_button_size_changed), self);

    self->style_set_id = g_signal_connect(G_OBJECT(self), "style-set",
                     G_CALLBACK(places_button_theme_changed), NULL);
    self->screen_changed_id = g_signal_connect(G_OBJECT(self), "screen-changed",
                     G_CALLBACK(places_button_theme_changed), NULL);

}
Exemplo n.º 17
0
static void
xfce_constructor (XfcePanelPlugin *plugin)
{
	MultiloadPlugin *multiload = multiload_new();

	multiload->panel_data = plugin;
	multiload->panel_orientation = xfce_panel_plugin_get_orientation (plugin);
	gtk_container_add (GTK_CONTAINER (plugin), GTK_WIDGET(multiload->container));

	multiload_ui_read (multiload);
	multiload_start(multiload);


	/* show the panel's right-click menu on this ebox */
	xfce_panel_plugin_add_action_widget (plugin, GTK_WIDGET(multiload->container));


	/* plugin signals */
	g_signal_connect(G_OBJECT(plugin), "free-data",           G_CALLBACK (xfce_free_cb),                multiload);
	g_signal_connect(G_OBJECT(plugin), "save",                G_CALLBACK (xfce_save_cb),                multiload);
	g_signal_connect(G_OBJECT(plugin), "size-changed",        G_CALLBACK (xfce_size_changed_cb),        multiload);
	g_signal_connect(G_OBJECT(plugin), "orientation-changed", G_CALLBACK (xfce_orientation_changed_cb), multiload);

	/* menu items */
	GtkMenuItem *mi_separator = GTK_MENU_ITEM(gtk_separator_menu_item_new ());
	GtkMenuItem *mi_help = GTK_MENU_ITEM(gtk_menu_item_new_with_mnemonic (_("_Help")));
	GtkMenuItem *mi_sysmon = GTK_MENU_ITEM(gtk_menu_item_new_with_label(_("Start task manager")));
	xfce_panel_plugin_menu_show_configure (plugin);
	xfce_panel_plugin_menu_show_about (plugin);
	xfce_panel_plugin_menu_insert_item (plugin, mi_separator);
	xfce_panel_plugin_menu_insert_item (plugin, mi_help);
	xfce_panel_plugin_menu_insert_item (plugin, mi_sysmon);
	g_signal_connect (G_OBJECT (plugin), "configure-plugin",	G_CALLBACK (xfce_configure_cb), multiload);
	g_signal_connect (G_OBJECT (plugin), "about",				G_CALLBACK (xfce_about_cb), NULL);
	g_signal_connect (G_OBJECT (mi_help), "activate",			G_CALLBACK (xfce_help_cb), NULL);
	g_signal_connect (G_OBJECT (mi_sysmon), "activate",			G_CALLBACK (xfce_sysmon_cb), multiload);
	gtk_widget_show(GTK_WIDGET(mi_separator));
	gtk_widget_show(GTK_WIDGET(mi_help));
	gtk_widget_show(GTK_WIDGET(mi_sysmon));
}
Exemplo n.º 18
0
static gboolean windowck_size_changed(XfcePanelPlugin *plugin, gint size, WindowckPlugin *wckp)
{
    GtkOrientation orientation;

    /* get the orientation of the plugin */
    orientation = xfce_panel_plugin_get_orientation(plugin);

    /* set the widget size */
    if (orientation == GTK_ORIENTATION_HORIZONTAL)
        gtk_widget_set_size_request(GTK_WIDGET (plugin), -1, size);
    else
        gtk_widget_set_size_request(GTK_WIDGET (plugin), size, -1);

    /* set icon size */
    if (size >= 32)
        wckp->icon->size = GTK_ICON_SIZE_SMALL_TOOLBAR;
    else
        wckp->icon->size = GTK_ICON_SIZE_MENU;

    /* we handled the orientation */
    return TRUE;
}
Exemplo n.º 19
0
static SamplePlugin *
sample_new (XfcePanelPlugin *plugin)
{
  SamplePlugin   *sample;
  GtkOrientation  orientation;
  GtkWidget      *label;

  /* allocate memory for the plugin structure */
  sample = panel_slice_new0 (SamplePlugin);

  /* pointer to plugin */
  sample->plugin = plugin;

  /* read the user settings */
  sample_read (sample);

  /* get the current orientation */
  orientation = xfce_panel_plugin_get_orientation (plugin);

  /* create some panel widgets */
  sample->ebox = gtk_event_box_new ();
  gtk_widget_show (sample->ebox);

  sample->hvbox = gtk_box_new (orientation, 2);
  gtk_widget_show (sample->hvbox);
  gtk_container_add (GTK_CONTAINER (sample->ebox), sample->hvbox);

  /* some sample widgets */
  label = gtk_label_new (_("Sample"));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (sample->hvbox), label, FALSE, FALSE, 0);

  label = gtk_label_new (_("Plugin"));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (sample->hvbox), label, FALSE, FALSE, 0);

  return sample;
}
Exemplo n.º 20
0
static i3WorkspacesPlugin * i3_workspaces_new (XfcePanelPlugin *plugin)
{
    i3WorkspacesPlugin   *i3_workspaces;
    GtkOrientation  orientation;
    GtkWidget      *label;

    /* allocate memory for the plugin structure */
    i3_workspaces = panel_slice_new0 (i3WorkspacesPlugin);

    /* pointer to plugin */
    i3_workspaces->plugin = plugin;

    /* get the current orientation */
    orientation = xfce_panel_plugin_get_orientation (plugin);

    /* create some panel widgets */
    i3_workspaces->ebox = gtk_event_box_new ();
    gtk_widget_show (i3_workspaces->ebox);

    i3_workspaces->hvbox = xfce_hvbox_new (orientation, FALSE, 2);
    gtk_widget_show (i3_workspaces->hvbox);
    gtk_container_add (GTK_CONTAINER (i3_workspaces->ebox), i3_workspaces->hvbox);

    i3_workspaces->i3wm = i3wm_construct();

    i3_workspaces->buttons = (GtkWidget **) g_malloc0(sizeof(GtkWidget *) * I3_WORKSPACE_N);

    i3wm_set_workspace_created_callback(i3_workspaces->i3wm, i3_on_workspace_created, i3_workspaces);
    i3wm_set_workspace_destroyed_callback(i3_workspaces->i3wm, i3_on_workspace_destroyed, i3_workspaces);
    i3wm_set_workspace_focused_callback(i3_workspaces->i3wm, i3_on_workspace_focused, i3_workspaces);
    i3wm_set_workspace_blurred_callback(i3_workspaces->i3wm, i3_on_workspace_blurred, i3_workspaces);

    i3_add_workspaces(i3_workspaces);

    return i3_workspaces;
}
Exemplo n.º 21
0
static gboolean get_applet_vert(XfcePanelPlugin *plugin)
{
    return xfce_panel_plugin_get_orientation(plugin) == GTK_ORIENTATION_VERTICAL;
}
Exemplo n.º 22
0
static gboolean
xfce_xkb_set_size (XfcePanelPlugin *plugin, gint size,
                   t_xkb *xkb)
{
    return xkb_calculate_sizes (xkb, xfce_panel_plugin_get_orientation (plugin), size);
}
bool Plugin::horizontal() const
{
  GtkOrientation orient = xfce_panel_plugin_get_orientation(xfce_plugin);
  return orient == GTK_ORIENTATION_HORIZONTAL;
}